How to regenerate (or export/import) data for the energy dashboard?

Hi,
i have a HA installation with standard database.
To cleanup data from an old integration I used developer/statistic to delete all statistics beginning with “AC500_”.
Unfortunately I forgot that I have an entry “AC500_PV_IN_Energy” in my configuration.yaml which uses the rieman integration to generate energy information for the energy dashboard. This is used by another integration which I want to keep.

Now the problem is that the energy dashboard does not anymore show any data for “AC500_PV_IN_Energy” from 17th April back.

But if I click on the “AC500_PV_IN_Energy” in the energy dashboard to open the history I still can see all the data from 17th April back.

Unfortunately my last Backup is 2 weeks old and I changed some integrations in the meantime which I don’t want to redo again.

So, since the historical sensor data is still available, is there a way to use this data to regenerate the data needed by the energy dashboard display ?

Or if that is not possible: I would restore my backup to a virtual HA installation and try to export that missing energy data from there and try to import it into my current HA installation (after making a backup).
Is that possible via SQL commands ? If yes, anybody got a sample/hint how to accomplish that ?
Here are some screenshots to show that the “AC500_PV_IN_Energy” is 0kwh in the energy dashboard on the 17th April (and all days before that) but the “AC500_PV_IN_Energy” still shows valid data for the 17th and back:

I don’t know any way to Import the data you are asking. In the Energy dashboard there is a way to export in CSV.
Or another way, but very manual, vould be to use the statistics editor in the Developer Tools.

I found a script which allows proper import of energy data, I am trying to use that but have to understand it first: