Automation - append to google sheet

Hi

I have created an automation for saving energy measurements in a google sheet…

It works fine as long as i am trying to save a “state” value… but trying to get the automation to save an attribute of a sensor keeps failing…

I am novice in this templating stuff… but i can call the value in the template developer tool… But transferring it to the automation wont work…

Here are 2 lines… “date” is the one that keeps failing… the second line works fine for the state value…

Date: "{{ state_attr('sensor.eloverblik_energy_0_1', 'metering_date') }}"
kl. 00-01: "{{ states['sensor.eloverblik_energy_0_1'].state | float(0) }}"

Metering date should return a value like “2022-11-13”… instead i get a popup saying “Error running automation - unknown error”…

If i remove the “Date:…” line it works fine…

Any1 knows what is wrong with my Date line?? I have tried if i could figure a way to call the attribute “metering_date” in a format that looks more like the second line, to see if that was the answer… but with no luck so far…

best regards

Leandrial.