0

I am new to programming and am trying to extract values from an API.

The connection to the API went fine, but I can't extract all pairs (Property:property Value) from a JavaScript object and put them into rows and columns in Google Sheets. Is this possible?

As in the picture: I was able to access the "timeline" information. Can I put the pairs in rows and columns in Google Sheet?

Example:

A B C
1 2022-10-31 431.0
2 2022-11-01 1177.0
3 2022-11-02 827.0
4 2022-11-03 878.0
5 2022-11-04 704.0
6 2022-11-05 909.0
7 2022-11-06 1135.0
... ... ...

Thank you very much! Sorry if I made any mistakes, I'm just starting to learn!

  • You can use `Object.entries(impressionsPerDay)` to convert the object into an array of `[key, value]` items. – Barmar Nov 07 '22 at 18:12
  • Hi @Barmar, thank you! I did this and I made some progress: var impressionsPerDay = results["summary"]["impr."]["timeline"] for (const [key, value] of Object.entries(impressionsPerDay)) { console.log(`${key}: ${value}`); } Now I will try to put this information into the table! Thank you very much! – Gabriel Belli Nov 07 '22 at 20:56

0 Answers0