Nuclear magnetic resonance (NMR) is a fundamental research tool that is widely used in many fields. Despite its powerful applications, unfortunately the low sensitivity of conventional NMR makes it difficult to study thin film or nano-sized samples. In this work, we report the first NMR spectrum obtained from general thin films by using magnetic resonance force microscopy (MRFM). To minimize the amount of imaging information inevitably mixed into the signal when a gradient field is used, we adopted a large magnet with a flat end with a diameter of 336 mm that generates a homogeneous field on the sample plane and a field gradient in a direction perpendicular to the plane. Cyclic adiabatic inversion was used in conjunction with periodic phase inversion of the frequency shift to maximize the SNR. In this way, we obtained the F-19 NMR spectrum for a 34 nm-thick CaF2 thin film.