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
Javascript 在Google应用程序脚本中返回多个参数值_Javascript_Google Apps Script_Google Sheets_Google Spreadsheet Api - Fatal编程技术网

Javascript 在Google应用程序脚本中返回多个参数值

Javascript 在Google应用程序脚本中返回多个参数值,javascript,google-apps-script,google-sheets,google-spreadsheet-api,Javascript,Google Apps Script,Google Sheets,Google Spreadsheet Api,我目前正在构建一个表单,其中包含一个模态/侧边栏。我的问题是,我确实需要从*.gs文件中的函数传递多个值 目前我知道我可以实现这一点: google.script.run.withSuccessHandler(myFunction).gasFunction('argument value'); Index.html 因此,为了返回所需的所有参数,我正在多次运行一个连续方法 google.script.run.withSuccessHandler(indexLog).logMe('value 1

我目前正在构建一个表单,其中包含一个模态/侧边栏。我的问题是,我确实需要从*.gs文件中的函数传递多个值

目前我知道我可以实现这一点:

google.script.run.withSuccessHandler(myFunction).gasFunction('argument value');
Index.html 因此,为了返回所需的所有参数,我正在多次运行一个连续方法

google.script.run.withSuccessHandler(indexLog).logMe('value 1');
google.script.run.withSuccessHandler(indexLog).logMe('value 2');
google.script.run.withSuccessHandler(indexLog).logMe('value 2');
我的值将是单元格引用,但我需要一个范围而不是单个单元格值

然后,我将获取这些值,并希望从这些值构建一个数组,以便在for循环函数中正确迭代这些值


提前谢谢

在方法的细节中

电子表格app.getActiveSheet().getRange(单元格).getValue()

function returnCellValue(cell) {
    return (SpreadsheetApp.getActiveSheet().getRange(cell).getValue());
}
function returnCellValue(cell) {
    return (SpreadsheetApp.getActiveSheet().getRange(cell).getValues());
}
即使输入了范围,也只返回1个值getValue()无论范围如何,只返回1个值

电子表格app.getActiveSheet().getRange(单元格).getValues()

function returnCellValue(cell) {
    return (SpreadsheetApp.getActiveSheet().getRange(cell).getValue());
}
function returnCellValue(cell) {
    return (SpreadsheetApp.getActiveSheet().getRange(cell).getValues());
}
使用getValues()将范围作为数组传递,然后我可以对其进行迭代。目前,Google应用程序脚本和工作表仅支持触摸单元格的范围,因此,如果所需范围不是所引用单元格的相邻区域,则不能使用逗号分隔符来定义所有范围