With the Ultraviolet Visual Echelle Spectrograph mounted at the Very Large Telescope, we have observed at unprecedented spectral resolution the absorption spectrum toward reddened stars in the Magellanic Clouds over the wavelength range of 3500-10500 Å. This range covers the strong transitions associated with neutral and charged large carbon molecules of varying sizes and structures. We report the first detection of diffuse interstellar bands (DIBs) at 5780 and 5797 Å in the Small Magellanic Cloud and the variation of those DIBs toward several targets in the Large Magellanic Cloud. The variation of DIBs in the Magellanic Clouds compared with Galactic targets may be governed by a combination of the different chemical processes prevailing in low-metallicity regions and the local environmental conditions. The analysis of high-resolution absorption spectra allows us to reveal the global effects in the chemistry and recycling of cosmic dust in the Magellanic Clouds which are relevant for the chemical pathways forming large organic molecules in external galaxies.