๐Ÿšจ Gemini Script Extracts Data Perfectly โ€” But AppSheet Just Wonโ€™t Save It?!

Hi everyone,

Iโ€™ve followed this excellent guide by Martin Hawksey to connect a Gemini-powered Apps Script function (jsonControlledImageExtraction) with AppSheet.

The script receives an image URL, extracts structured data using Geminiโ€™s JSON schema, and returns a valid object. AppSheet automation is set up as:

โ€ขโ€œRun a taskโ€ โ†’ โ€œCall a scriptโ€
โ€ขReturn type: Object

โ€ขThen โ†’ Set Values to map the output fields

โœ…The function runs fine, returns the expected object, and shows correct output in the logs.
โŒHowever, the extracted values are not being written to Google Sheets.

Could it be a problem with:
โ€ขHow Set Values is configured?
โ€ขMissing row context?
โ€ขSome sync issue between AppSheet and Sheets?

Would appreciate any insights or fixes โ€” thanks in advance!

 

Islom_1-1742919626588.pngIslom_0-1742919593345.png

 

 

Solved Solved
2 3 230
1 ACCEPTED SOLUTION


@Islom wrote:

However, the extracted values are not being written to Google Sheets.


You need to access the Monitor Logs. At the top of your Bot is a "Monitor" button.  Tap that and then access the "Runs" tab.  Find the Bot execution entry and check the "Process Steps" panel on the far right to see the outcome of your Bot steps.  Look at the "GeminiApp" step and confirm that you are getting a returned object in the Bot itself.  If you are and the JSON object looks correct then it is a matter of making sure you are accessing the returned object correctly.   See article below for details on how to use returned JSON objects.

Use return values from Apps Script Task

Also be aware that if you have any requirements or validation implemented, your row WILL be subjected to those while attempting to assign the Object values.  You may need to look into the Audit Logs to see any violations of those conditions.

I hope this helps!

 

View solution in original post

3 REPLIES 3


@Islom wrote:

However, the extracted values are not being written to Google Sheets.


You need to access the Monitor Logs. At the top of your Bot is a "Monitor" button.  Tap that and then access the "Runs" tab.  Find the Bot execution entry and check the "Process Steps" panel on the far right to see the outcome of your Bot steps.  Look at the "GeminiApp" step and confirm that you are getting a returned object in the Bot itself.  If you are and the JSON object looks correct then it is a matter of making sure you are accessing the returned object correctly.   See article below for details on how to use returned JSON objects.

Use return values from Apps Script Task

Also be aware that if you have any requirements or validation implemented, your row WILL be subjected to those while attempting to assign the Object values.  You may need to look into the Audit Logs to see any violations of those conditions.

I hope this helps!

 

Islom_0-1742960190649.png

 

Thanks for the guidance!

I checked the Monitor > Runs > Process Steps as you suggested. The function does run and returns the correct values (as seen in the screenshot). However, AppSheet still throws the error:

โ€œFailed App Script type translation: Schema has more than one column but no object was returned.โ€

Whatโ€™s confusing is that the Cloud logs show a proper object coming back from Gemini (with product_name, product_code, etc.). But in the Monitor panel, the return value seems to be wrapped inside a structure like this:

{
  "listValue": {
    "values": [
      {
        "structValue": {
          "fields": {
            ...
          }
        }
      }
    ]
  }
}

So it looks like AppSheet isnโ€™t recognizing it as a flat object, which causes the โ€œno object returnedโ€ error โ€” even though it technically is.

Would appreciate any help figuring out how to make the return value AppSheet-compatible. Thanks again!

Thanks a lot for the help! ๐Ÿ™Œ You were right โ€” the issue was with how the object was wrapped. Once I adjusted the return structure to a flat object, AppSheet picked it up perfectly. Appreciate your guidance

Islom_0-1743348960245.pngIslom_1-1743349034188.pngIslom_2-1743349054628.png