To develop fast and integrated spectrometry, we present a new method of compressed sensing spectrometry based on electro-optical transmittance coding. A LiNbO3 electro-optic modulator was applied to a directly compressed measurement code in the spectral dimension. Subsequently, a sequential forward floating selection algorithm was employed to select the coding measurement matrix, and sparsity adaptive matching pursuit was used as a solver algorithm. The principle was analyzed, and the measurement system was built for verification experiments. The experimental results reveal that the spectral reconstruction relative error is in the order of 10−2, and the full width at half maximum of the spectral measurement is as high as 1.2 nm. The spectral resolution can reach approximately 0.4 nm in the visible light band range (0.38–0.78 μm) with 1024 spectral channels. The compressed ratio of the compressed sensing spectrometry is up to 1:29. Furthermore, the spectral signal measurement time is only 0.25 ms. The study demonstrates a novel method, which exhibits high precision, speed, high compressed ratio and hyperspectral resolution.