Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.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 Apps Script_Google Sheets - Fatal编程技术网

Google apps script 为什么可以';它不能从活动范围中找到列吗?

Google apps script 为什么可以';它不能从活动范围中找到列吗?,google-apps-script,google-sheets,Google Apps Script,Google Sheets,非常新,正在尝试设置一个警报对话框,但在测试代码时,我不明白为什么我的“var列”不起作用。对话框窗口应提醒任何单击按钮的人,他们将要将客户名称复制到作业簿中当月的选项卡 我哪里做错了 function onOpen() { SpreadsheetApp.getUi() .createMenu('Custom Menu') .addItem('Show alert', 'showAlert') .addToUi();

非常新,正在尝试设置一个警报对话框,但在测试代码时,我不明白为什么我的“var列”不起作用。对话框窗口应提醒任何单击按钮的人,他们将要将客户名称复制到作业簿中当月的选项卡

我哪里做错了

function onOpen() {
      SpreadsheetApp.getUi() 
          .createMenu('Custom Menu')
          .addItem('Show alert', 'showAlert')
          .addToUi();
    }

function showAlert() {
  var ss = SpreadsheetApp.getActive();
  var range = ss.getActiveRange();
  var column = range.getRange(range.getRowIndex(), 1).getValue();
  var ui = SpreadsheetApp.getUi();
  var getMonth = Utilities.formatDate(date, Session.getScriptTimeZone(), "MMM");

  var copyTest = ui.alert(
     'This will copy customer '&column&' to the '&getMonth&' JOB BOOK tab.',
     'Do you want to continue?',
      ui.ButtonSet.YES_NO);

  if (result == ui.Button.YES) {

    ui.alert('Customer '&column&' has been copied to the JOB BOOK.');
  } else {

    ui.alert('Operation cancelled. You"'"ll get em next time, tiger.');
  }
}

应改为:

var column = ss.getRange(range.getRowIndex(), 1).getValue();

您能否提供有关我的“var列”不工作的详细信息?如果发生错误,您能显示它吗?在您的脚本中,我认为在保存脚本时,
ui.alert(操作已取消。您“”“将在下次获取它们,tiger”)处发生错误。这个怎么样?
var column = ss.getRange(range.getRowIndex(), 1).getValue();