The CUPID-Mo experiment, located at Laboratoire Souterrain de Modane (France), was a demonstrator experiment for CUPID. It consisted of an array of 20 Li2100MoO4 (LMO) calorimeters each equipped with a Ge light detector (LD) for particle identification. In this work, we present the result of a search for two-neutrino and neutrinoless double beta decays of 100Mo to the first 0+ and 2+ excited states of 100Ru using the full CUPID-Mo exposure (2.71 kg×yr of LMO). We measure the half-life of 2νββ decay to the 01+ state as T1/22ν→01+=7.5±0.8(stat.)−0.3+0.4(syst.))×1020yr. The bolometric technique enables measurement of the electron energies as well as the gamma rays from nuclear de-excitation and this allows us to set new limits on the two-neutrino decay to the 21+ state of T^{2\nu \rightarrow 2_1^+}_{1/2}>4.4\times 10^{21} \ \mathrm{yr} \ \text{(90 % c.i.)} and on the neutrinoless modes of T_{1/2}^{0\nu\rightarrow 2_1^+}>2.1\times10^{23} \ \mathrm{yr}\ \text{(90 % c.i.)}, T_{1/2}^{0\nu\rightarrow 0_1^+}>1.2\times10^{23} \ \mathrm{yr}\ \text{(90 % c.i.)}. Information on the electrons spectral shape is obtained which allows us to make the first comparison of the single state (SSD) and higher state (HSD) 2νββ decay models for the 01+ excited state of 100Ru