Nice work BTW👍
I can see that the use of a macro code such as the one you posted is an excellent way of transforming the data that is available via 3rd parties and perhaps one of these days I may be forced into this route. That being said copying (via looking) accurate kWh usage into my energy spreadsheet via the expedient of a working IHD (as I have) takes me less time than it does to boot up my PC (and that is with an SSD boot drive) 😎. So long as I have connectivity of my meters to Bright via DCC I can even lift said numbers from daily numbers Bright (the day after) if my IHD decides to meet its maker. Of course those with accessible non-smart meters like @retrotecchie are equally at home with lifting the numbers directly from the meter and leaving a good old spreadsheet to do any computational/graphical analysis.
As we all know there are plenty of ways to skin this particular energy cat. The OP can take their pick as we have all provided different routes to achieve their objective. Unfortunately those relying purely on Eon Next (esp via the app) are likely to be a little disappointed as I still see odd days on the Eon Next app with missing data - days that Bright does have populated. Probably the reason why even many of us smarties recommend Bright irrespective of whether the IHD is functioning accurately. 👍