Google apps script Appscript:单击时在列中标记时间的按钮

Google apps script Appscript:单击时在列中标记时间的按钮,google-apps-script,google-sheets,Google Apps Script,Google Sheets,需要在谷歌表单上创建一个按钮,当点击AA列中的时间戳时 非常感谢。以下脚本可能会对您有所帮助 此代码每次运行时都会更新单元格AA1中的时间戳 function setTimeStamp() { SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('AA1').setValue(new Date()) } function addTimeStamp(){ let sheet = SpreadsheetApp.get

需要在谷歌表单上创建一个按钮,当点击AA列中的时间戳时


非常感谢。

以下脚本可能会对您有所帮助

此代码每次运行时都会更新单元格AA1中的时间戳

function setTimeStamp() {
  SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('AA1').setValue(new Date())  
}
function addTimeStamp(){
  let sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1')
  sheet.getRange('AA'+(sheet.getRange('AA:AA').getValues().filter(String).length+1)).setValue(new Date())  
}
这段代码每次运行时都会向AA列添加一个时间戳

function setTimeStamp() {
  SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('AA1').setValue(new Date())  
}
function addTimeStamp(){
  let sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1')
  sheet.getRange('AA'+(sheet.getRange('AA:AA').getValues().filter(String).length+1)).setValue(new Date())  
}