Google Sheets api results 'Unknown'

I maintain a spreadsheet on google drive where I record honey harvested from my beehives.
What I want is to simply display the value of one cell (cumulative weight) in my Home Assistant (alongside graphs of temp data etc which Ive got working OK).

So I set up the Google Sheets API to allow access to the data and added a sensor to my config file:

  - platform: rest
    method: GET
    name: "Cumulative Weight"
    value_template: '{{value_json["values"] [0] | int }}'
    scan_interval: 86400

All good, Cumulative Weight shows up as an entity, but the value is always returned as ‘Unknown’.

When I check the output of the API Monitor in the template editor I get the following:

Result type:List

I suspect this is the problem: the results are being returned as a list for some reason.

I’m not sure if this is a problem with HA, or with the way the API is returning results, but any and all help gratefully received

(If I can this working, I’d also like to plot the time-series data for honey collection, but thats another problem!)


I think you should remove the space between “values”] and [0] ans add another [0] to get the final value:

'{{value_json["values"][0][0] | int }}'