Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 自定义函数Google Sheets,用于显示包含来自另一个单元格的值的消息_Google Apps Script_Google Sheets_Google Sheets Custom Function - Fatal编程技术网

Google apps script 自定义函数Google Sheets,用于显示包含来自另一个单元格的值的消息

Google apps script 自定义函数Google Sheets,用于显示包含来自另一个单元格的值的消息,google-apps-script,google-sheets,google-sheets-custom-function,Google Apps Script,Google Sheets,Google Sheets Custom Function,我一直在做这个函数,希望在弹出的消息中显示特定单元格的值 这个单元格与“当前单元格”在同一行,如果这有什么帮助的话,我只是非常困惑,甚至不确定这是否可能 function my2ndFunction() { var cell = SpreadsheetApp.getCurrentCell(); var ui = SpreadsheetApp.getUi(); var response = ui.alert('Do you want to start?', '', ui.ButtonS

我一直在做这个函数,希望在弹出的消息中显示特定单元格的值

这个单元格与“当前单元格”在同一行,如果这有什么帮助的话,我只是非常困惑,甚至不确定这是否可能

function my2ndFunction() {
  var cell = SpreadsheetApp.getCurrentCell();
  var ui = SpreadsheetApp.getUi();
  var response = ui.alert('Do you want to start?', '', ui.ButtonSet.YES_NO);
  var output;
  if (response == ui.Button.YES) {
    cell.setValue(new Date());
  }
}

谢谢你的关注

您只需在if条件中添加另一条警报消息,如下所示:

function my2ndFunction() {
  var cell = SpreadsheetApp.getCurrentCell();
  var ui = SpreadsheetApp.getUi();
  var response = ui.alert('Do you want to start?', '', ui.ButtonSet.YES_NO);
  var output;
  if (response == ui.Button.YES) {
    cell.setValue(new Date());
    ui.alert('The current date is: ' + new Date())
  }
}

您只需在if条件中添加另一条警报消息,如下所示:

function my2ndFunction() {
  var cell = SpreadsheetApp.getCurrentCell();
  var ui = SpreadsheetApp.getUi();
  var response = ui.alert('Do you want to start?', '', ui.ButtonSet.YES_NO);
  var output;
  if (response == ui.Button.YES) {
    cell.setValue(new Date());
    ui.alert('The current date is: ' + new Date())
  }
}
请记住,当一个答案回答你的问题时,它甚至是它,这样其他人也可以受益。请记住,当一个答案回答你的问题时,它甚至是它,这样其他人也可以受益。