The Euclid mission will conduct an extragalactic survey over 15000deg^2^ of the extragalactic sky. The spectroscopic channel of the Near-Infrared Spectrometer and Photometer (NISP) has a resolution of R~450 for its blue and red grisms that collectively cover the 0.93-1.89um range. NISP will obtain spectroscopic redshifts for 3x10^7^ galaxies for the experiments on galaxy clustering, baryonic acoustic oscillations, and redshift space distortion. The wavelength calibration must be accurate within 5{AA} to avoid systematics in the redshifts and downstream cosmological parameters. The NISP pre-flight dispersion laws for the grisms were obtained on the ground using a Fabry-Perot etalon. Launch vibrations, zero gravity conditions, and thermal stabilisation may alter these dispersion laws, requiring an in-flight recalibration. To this end, we use the emission lines in the spectra of compact planetary nebulae (PNe), which were selected from a PN data base. To ensure completeness of the PN sample, we developed a novel technique to identify compact and strong line emitters in Gaia spectroscopic data using the Gaia spectra shape coefficients. We obtained VLT/X-SHOOTER spectra from 0.3 to 2.5um for 19 PNe in excellent seeing conditions and a wide slit, mimicking Euclid's slitless spectroscopy mode but with 10 times higher spectral resolution. Additional observations of one northern PN were obtained in the 0.80-1.90um range with the GMOS and GNIRS instruments at the Gemini North observatory. The collected spectra were combined into an atlas of heliocentric vacuum wavelengths with a joint statistical and systematic accuracy of 0.1{AA} in the optical and 0.3{AA} in the near-infrared. The wavelength atlas and the related 1D and 2D spectra are made publicly available.