This paper describes the preflight spectral calibration methods and results for the Orbiting Carbon Observatory 2 (OCO-2), following the approach developed for the first OCO. The instrument line shape (ILS) function and dispersion parameters were determined through laser-based spectroscopic measurements, and then further optimized by comparing solar spectra recorded simultaneously on the ground by the OCO-2 flight instrument and a collocated high-resolution Fourier transform spectrometer (FTS). The resulting ILS profiles and dispersion parameters, when applied to the FTS solar data, showed agreement between the spectra recorded by the spectrometers and FTS to approximately 0.2% RMS, satisfying the preflight spectral calibration accuracy requirement of <0.25% RMS. Specific changes to the OCO-2 instrument and calibration process, compared to the original OCO, include stray-light protection; improved laser setup; increased spectral sampling; enhanced data screening, and incremental improvements in the ILS, dispersion, and FTS optimization analyses.