The following code inserts new Date()
as Mon Sep 04 21:34:54 GMT+01:00 2017
Using Google Sheets API v4, Sheets.Spreadsheets.Values.update
function withUpdate() {
var spreadsheetId = "someSpreadsheetId";
var request = {
majorDimension: "ROWS",
values: [[new Date()]]
};
Sheets.Spreadsheets.Values.update(
request,
spreadsheetId,
"Sheet1!BW20",
{valueInputOption: "USER_ENTERED"}
);
}
The following code inserts new Date()
as 04.09.2017 21:34:54
Using Google Apps Script, getRange().setValue
function withSetValue () {
var spreadsheet = SpreadsheetApp.openById("someSpreadsheetId")
var sheetOne = spreadsheetId.getSheetByName("Sheet1");
sheetOne.getRange(20, 75).setValue(new Date());
}
Is it possible to make [i.e. Google Sheets API v4] to insert new Date()
the same way as Google Apps Script inserts it in the following format: 04.09.2017 21:34:54
? How to avoid getting this format Mon Sep 04 21:34:54 GMT+01:00 2017
with Values.update
?
Thank you.