Formaldehyde (H$_2$CO) is an important precursor to organics like methanol (CH$_3$OH). It is important to understand the conditions that produce H$_2$CO and prebiotic molecules during star and planet formation. H$_2$CO possesses both gas-phase and solid-state formation pathways, involving either UV-produced radical precursors or CO ice and cold ($lesssim 20$ K) dust grains. To understand which pathway dominates, gaseous H$_2$COs ortho-to-para ratio (OPR) has been used as a probe, with a value of 3 indicating warm conditions and $<3$ linked to cold formation in the solid-state. We present spatially resolved ALMA observations of multiple ortho- and para-H$_2$CO transitions in the TW Hya protoplanetary disk to test H$_2$CO formation theories during planet formation. We find disk-averaged rotational temperatures and column densities of $33pm2$ K, ($1.1pm0.1)times10^{12}$ cm$^{-2}$ and $25pm2$ K, $(4.4pm0.3)times10^{11}$ cm$^{-2}$ for ortho- and para-H$_2$CO, respectively, and an OPR of $2.49pm0.23$. A radially resolved analysis shows that the observed H$_2$CO emits mostly at rotational temperatures of 30-40 K, corresponding to a layer with $z/Rge0.25$. The OPR is consistent with 3 within 60 au, the extent of the pebble disk, and decreases beyond 60 au to $2.0pm0.5$. The latter corresponds to a spin temperature of 12 K, well below the rotational temperature. The combination of relatively uniform emitting conditions, a radial gradient in the OPR, and recent laboratory experiments and theory on OPR ratios after sublimation, lead us to speculate that gas-phase formation is responsible for the observed H$_2$CO across the TW Hya disk.