Context. Angular differential imaging (ADI) and spectral differential imaging (SDI) are well-established high-contrast imaging techniques, but their application is challenging for companions at small angular separations from their host stars. Aims. The aim of this paper is to investigate to what extent adaptive-optics assisted, medium-resolution (R ~ 5000) integral field spectrographs (IFS) can be used to directly detect the absorption of molecular species in the spectra of planets and substellar companions when these are not present in the spectrum of the star. Methods. We analysed archival data of the β Pictoris system taken with the SINFONI integral field spectrograph located at ESO’s Very Large Telescope, originally taken to image β Pic...