Read data from Google sheets

Consider adding a new sheet to your design, with one row for each additional list item, identified by the key of its owner.

See the Order Item sheet in this Pizza Store sample, built for a (hopefully) upcoming Google Sheets component ...

Having the list items in a separate sheet, lined up in the same column, allows you to do some SQL-like grouping and summation.

Exactly. So the second list will have empty items at the end? Too bad there is no block for removing empty list items :upside_down_face: .

But then you would have an improper csv/listofLists

If you attempted to iterate over a list of lists with different lengths, AI2 would complain....

Suggested reading:
Data Normalization

I followed you but can't look up the data, please help

googlesheet

  • Are you certain your sheet is called sheet1 and not Sheet1 (uppercase S) ?
  • You don't show a query you have tested with
  • Is your script correctly deployed ?
1 Like

Also see:

1 Like

I tried but still can't run

Please check the code for me, and sheet and Sheet (in uppercase and lowercase) I have corrected but still not working

Please check the code for me, and sheet and Sheet (in uppercase and lowercase) I have corrected but still not working

It appears that your sheet is called Sheet but you are sending sheet1 in the blocks

1 Like

Try Sheet, with a capital "S."

2 Likes

I make google sheet data query, i tried my best. however, it still does not work. Can anyone help me see if there is an error, the code, or do I need to install any additional google sheets add-ons?

What query are you trying ?

Are you sure you have your google apps script published and your script url in your app is the same?

1 Like

I've fixed it many times, but still can't get the query. #ERROR announcement!
https://script.google.com/macros/s/AKfycbzAXLlAO0XBsq1Ms98hES9wuTO03i72yXJC-mMEFbZGdq_TwQ/exec
17KQxRL-HALgY9etgTqa_mo4jXDYu_dlxTMka8d3w2ec

i don't know where it went wrong this is my google sheet

There is a problem with your google apps script web app. It could be an issue with your locale. Try changing this line in your script:

 var qry = '=query(' + rg + ';\"' + sql + '\";1)';

you will see I have replaced the , (commas) with ; (semi-colons).
Remember to deploy your script to a new version

If you run this in your computer browser you will see the data is returned in a table:

https://docs.google.com/spreadsheets/d/17KQxRL-HALgY9etgTqa_mo4jXDYu_dlxTMka8d3w2ec/gviz/tq?tqx=out:html&tq=SELECT%20*
4 Likes

I did it, thank you so much

how can i view it as a table on the phone screen. by column on google sheet trangtinh

I would use @Ken's Tableview extension, but you can use a webview with a javascript dynamic table, or make a table with labels

3 Likes