We report on the discovery of the C7N- anion towards the starless core TMC-1 and towards the carbon-rich evolved star IRC+10216. We used the data of the QUIJOTE line survey towards TMC-1 and found six lines in perfect harmonic frequency relation from J=27-26 up to J=32-31. The frequency of the lines can be reproduced with rotational and distortion constants of B=582.68490+/-0.00024 MHz and D=4.01+/-0.13 Hz, respectively. The standard deviation of the fit is 4 kHz. Towards IRC+10216 seventeen lines, from J=27-26 up to J=43-42, have been identified whose frequencies are also in harmonic relation providing B=582.6827+/-0.00085 MHz and D=3.31+/-0.31 Hz. The nearly exact coincidence of the rotational and distortion constants in both sources points unambigously to a common molecular carrier. Taking into account the chemical peculiarities of both sources, the carrier could be a radical or an anion. The radical can be discarded as the observed lines belong to a singlet species. Hence, the most possible carrier is an anion. High-level ab initio calculations indicate that C7N-, for which a rotational constant of B=582.0 MHz and a dipole moment of 7.5D have been computed, is the carrier of the lines in both sources. The neutral C7N has been predicted to have a ground electronic state 2Pi and a dipole moment around 1 D. Due to this low value of and to its much larger rotational partition function, its lines are expected to be well below the sensitivity of our data for both sources.