Under suitable conditions, we show that the Euler characteristic of a foliated Riemannian manifold can be computed only from curvature invariants which are transverse to the leaves. Our proof uses the hypoelliptic sub-Laplacian on forms recently introduced by two of the authors in Baudoin and Grong (Ann Glob Anal Geom 56(2):403–428, 2019).