Goal
I have a javascript query that is meant to trigger the Google Sheets resource to update a sheet by removing all of the data except from the header row in a particular sheet (similar to the suggestion in Clear all data rows from a Google Sheets, except that my approach is attempting to do that via a javascript query rather than through the resource query itself).
const emptyUpdate = Object.fromEntries(
Object.keys(inventoryTableSelectedRowData.value).map(key => [key, ''])
);
const emptyUpdateResult = await clearGoogleSheet.trigger({
sheetUpdate: emptyUpdate
});
Problem
I get the following error when executing that script: sheetUpdate must be an object, for example: {"column": "value"}
The object being passed into the sheetUpdate
arg is indeed an object, and is formatted to use the {"column": "value"}
structure mentioned in the error, so I'm guessing the issue lies in how I'm referencing sheetUpdate
as an arg that gets passed to that resource. I can also see from the state of the clearGoogleSheet
resource after executing this script that its sheetUpdate
is empty:
Also worth noting that the Google Sheets resource query I'm referencing (clearGoogleSheet
) works just fine when {{ Object.fromEntries(Object.keys(inventoryTableSelectedRowData.value).map(key => [key, ''])) }}
is passed into the Update values
field manually.
Am I doing something wrong in how I'm passing the update values into the Google Sheets resource in the js code up top?