Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How do I pass data into a Google Sheets API call?

Issue

I am having trouble passing data from an async JS object into a Google Sheets API call named write_data_3C. I have tried using a JS object to make the request, but it gives me the same error. The only error I receive is "write_data_3C failed to execute". I am unsure of how to pass variables into the API call, and I have been able to write things if they come from a table widget, but this data is coming from async JS objects. I am wondering if it's even possible to pass data into a GSheets API call or if it has to be stored in a UI widget.

Resolution

The user was trying to pass data from an async JavaScript object into a Google Sheets API call in Appsmith, but was getting an error message. They tried using a JS object to make the request instead, but still encountered the same error.

To solve this issue, another user suggested using the this.params method to pass parameters to the query. The solution involved modifying the GSheets query to include {{this.params.parts}} in place of the static data and then passing the partslist parameter using the params property of the write_data_3C action.

The user was able to successfully pass the data using this method and thanked the helper for their support.