Cannot get the right/correct syntax for Values.update, there is no examples of code for Google Apps Script on Google documentation. Tried to use the code pattern from batchUpdate limiting the range to one but it is not working. Could anyone please advise the correct syntax for Values.update? Here is the code:
function updateOneCell() {
var spreadsheetId = "someSpreadsheetId";
var request = {
"valueInputOption": "USER_ENTERED",
"data": [
{
"range": "Sheet1!BW7",
"majorDimension": "ROWS",
"values": [[new Date()]]
}
]
};
Sheets.Spreadsheets.Values.update(request, spreadsheetId);
}
It is giving the following error:
Invalid number of arguments provided. Expected 3-4 only
Thank you.
How about this modification?
Invalid number of arguments provided. Expected 3-4 only
This means that for Sheets of Advanced Google Services, Sheets.Spreadsheets.Values.update() has 3 or 4 arguments as follows.
Sheets.Spreadsheets.Values.update(resource, spreadsheetId, range)Sheets.Spreadsheets.Values.update(resource, spreadsheetId, range, optionalArgs)Range of BW7 cannot be used. Because the following error occurs.
Range ('Sheet1'!BW7) exceeds grid limits. Max rows: 1000, max columns: 26
The modified script reflected those is as follows.
function updateOneCell() {
var spreadsheetId = "someSpreadsheetId";
var request = {
majorDimension: "ROWS",
values: [[new Date()]]
};
Sheets.Spreadsheets.Values.update(
request,
spreadsheetId,
"Sheet1!A1",
{valueInputOption: "USER_ENTERED"}
);
}
If I misunderstand your question, I'm sorry.
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