We present analytical expressions and numerical results for the rates of energy exchange between oscillators and with the environment in a heterogeneous ensemble of globally coupled mechanical phase oscillators. The system is in stationary motion under the combined action of an external harmonic excitation, coupling, and friction. Individual moments of inertia and friction coefficients are different between oscillators. Three dynamical regimes, with different degrees of entrainment with the external excitation, are characterized. In two of these regimes, the rates of energy exchange show nontrivial dependence on the moments of inertia and friction coefficients, suggesting that the transfer of power between different parts of the ensemble can be manipulated by a convenient choice of the individual parameters.