History Download Data - automate

Hi HA Forum.
Hopefully this is an easy question.
Currently I can go to History, pick an entity and time range and download the data.

Is there a way to automate this process on an hourly or daily basis?
AND possibly append the data to the csv file?

Any help is greatly appreciated.

Not that I know of. But you can write the data to a csv file as it occurs.

See the example lower down.

Hi Tom. Thanks for that. I did try this before and did not manage to get the syntax right in config.yaml

I inserted the sections in yellow but yaml configuration complained:

You are missing a dash in front of platform: file.

Also please don’t post pictures of text. Post the actual text correctly formatted for the forum. See section 11 of the FAQ.

Thanks Tim for pointing out my error. That has saved perfectly now. I would have posted text but I wanted to annotate to clarify my issue. I will bear that in mind in future.

In the mean time I have found that using Node Red to “export” sensor data was slightly simpler using 3 nodes.