In the field of Gamma spectroscopy, the energy spectrum is a histogram of particle energies which is of interest in order to identify an unknown radioactive source. These energies are typically computed as the integral of electrical pulses generated the interaction of Gamma photons with a known semiconductor detector. Due to the finite resolution of the detector, close electrical pulses tend to overlap; this phenomenon, known by the practitioner as pileup effect, yields a severe distortion of the energy spectrum. We present in this contribution a method for pileup attenuation, in order to correct the main distortions caused by the pileup effect. This method can be decomposed in two steps. First, we compute a sparse representation of the signal by means of LASSO in order to estimate the arrival times of each individual electrical pulse and the radioactive source activity. The second step consists in estimating the pulse individual energies by means of another iteration of LASSO, with a smaller value of its sparsity parameter, and plug the obtained values into a standard nonparametric kernel estimator to obtain a corrected energy spectrum. We illustrate the performances of the suggested approach on signals stemming from a High Purity Germanium detector, with a medium activity.