Question

How do I create a Google Sheets rows from JSON text string?

  • 11 May 2024
  • 1 reply
  • 33 views

It doesn’t matter where it comes from but in the case I am using the MindStudio AI which sends a text response formulated as a single JSON string such as :

```
[{“ColumnA”:”ValueA1”,“ColumnB”:”ValueB1”},{“ColumnA”:”ValueA2”,“ColumnB”:”ValueB2”}]
```

How do I take this and create the two rows in Google Sheets? Do I need to loop?

 

I’m able to have it start with a different format if required.
 

I was also looking at this but it’s not clear to me how this works: https://help.zapier.com/hc/en-us/articles/8496275165709-Create-line-items-in-Zaps#h_01HJ1CTEWMZ42KSY0XQXF2D5QN


1 reply

Userlevel 7
Badge +11

Welcome to the Community, @alanwunsche! 🎉

I expect you’d need to use a Code by Zapier action step to convert the JSON into the necessary line items. Then, instead of using a Looping by Zapier action, you can use a Create Multiple Spreadsheet Rows (Google Sheets) action to add a new row for each line item output by the Code step. 

I can’t provide the specific code but we do have an AI-powered Code steps feature you could use to help generate the code for you! You can learn more about this here: Generate a Code step using AI (Beta)


Hope that helps to get you pointed in the right direction. If you run into any issues on that or have further questions just let us know!

Reply