  We present a detailed analysis of the X-ray and molecular gas emission in the
nearby galaxy NGC 34, to constrain the properties of molecular gas, and assess
whether, and to what extent, the radiation produced by the accretion onto the
central black hole affects the CO line emission. We analyse the CO Spectral
Line Energy Distribution (SLED) as resulting mainly from Herschel and ALMA
data, along with X-ray data from NuSTAR and XMM-Newton. The X-ray data analysis
suggests the presence of a heavily obscured AGN with an intrinsic luminosity of
L$_{\rm{1-100\,keV}} \simeq 4.0\times10^{42}$ erg s$^{-1}$. ALMA high
resolution data ($\theta \simeq 0.2''$) allows us to scan the nuclear region
down to a spatial scale of $\approx 100$ pc for the CO(6-5) transition. We
model the observed SLED using Photo-Dissociation Region (PDR), X-ray-Dominated
Region (XDR), and shock models, finding that a combination of a PDR and an XDR
provides the best fit to the observations. The PDR component, characterized by
gas density ${\rm log}(n/{\rm cm^{-3}})=2.5$ and temperature $T=30$ K,
reproduces the low-J CO line luminosities. The XDR is instead characterised by
a denser and warmer gas (${\rm log}(n/{\rm cm^{-3}})=4.5$, $T =65$ K), and is
necessary to fit the high-J transitions. The addition of a third component to
account for the presence of shocks has been also tested but does not improve
the fit of the CO SLED. We conclude that the AGN contribution is significant in
heating the molecular gas in NGC 34.
