Creating custom log entries into a file/database

I want to have an overview over my car chargings for invoicing reasons.

Therefore, im trying to build an automation which is able to collect different sensor/entity values and write them together in a file or database.

Automation should look like:

WHEN (I have this trigger avalable from my wallbox)

THEN
Collect data from different entities:

  • Timestamp
  • Current charging Session from Wallbox
  • total mileage of the vehicle

and write them into a data base entry/ or in a file like CSV

is there something like this possible (and how…)?

Use the file integration to write a csv

Thank you. I tried this but failed…

Now i found a good guideline to do it with google sheets integration which is working perfektly