Can't get Google Sheets API v4 to return multiple range values using batchGet. It is giving the following error (although the documentation says it needs valueRanges[], all the ranges and spreadsheetId are correct): "Extra args block must be a javascript object literal. (line 2, file "Code")"
Could you please help sort it out? Thank you. Here is the code:
function readRange(spreadsheetId) {
var response = Sheets.Spreadsheets.Values.batchGet("someSpreadSheetID", ["Sheet1!D7:F7", "Sheet1!J7:L7"]);
Logger.log(response.values);
}
All use of the Google Sheets API is available at no additional cost.
How about this modified script? In order to use this, please enable Sheet API v4 on API console and enable Sheet API v4 at Advanced Google Services.
function readRange(spreadsheetId) {
var response = Sheets.Spreadsheets.Values.batchGet(
"someSpreadSheetID",
{ranges: ["Sheet1!D7:F7", "Sheet1!J7:L7"]}
);
Logger.log(response.valueRanges);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With