We present a method to obtain diffraction limited spectrograms of extended sources from a series of ground-based slit- spectrograms. The method is a combination of speckle deconvolution (Keller & von der Luehe 1992) and a rapid spectrograph scanning scheme (Johannesson et al. 1992). The slit of a spectrograph is scanned over the solar surface while simultaneous slit-jaw images and spectrograms are recorded. The exposure time is short with respect to seeing-induced variations. A Knox-Thompson speckle reconstruction scheme is applied to the slit jaw images. From the individual slit-jaw images and their speckle reconstruction the instantaneous point spread function can be determined for any location. The spectrograms are reconstructed by inverting a matrix that describes the action of the point-spread function on the spectrograms. The final product is a three-dimensional cube formed by the two spatial coordinates and the wavelength. In the spatial domain the data is nearly diffraction limited while the spectral resolution is not affected by the reconstruction. The method is applied to observations of the quiet solar granulation.