Search code examples
jsongoogle-apps-scriptgoogle-sheetsapp-inventor

Select id from JSON


I'm currently designing an app to display some attributes of products I have in a pricelist which is stored in a Google Sheets spreadsheet and I want it to get that data and show it

I have a google script which extracts all the data from the spreadsheet and returns a JSON. It's published as a web app and stored in a non visible component "Web1"

Google Script result

What I don't know how to do is to work with that JSON and select a particular row based on an ID that I get from a barcode scanner

App interface

I want it to work like this:

  • Get a result from the barcode reader
  • Display the result from the barcode scan in a textbox "Código de barras"
  • Use that result to filter from a JSON which is extracted from the spreadsheet
  • Display the JSON attribute "name" in the textbox "Producto"

I currently have this:

App blocks


Solution

  • The web component works asynchronously, which means, first send the Get request and after having received the response in the GotText event, then do the further processing.

    enter image description here