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 importrange使用循环更改源url,将多个spreedsheet复制到一个中_Google Apps Script_Google Sheets Api - Fatal编程技术网

Google apps script importrange使用循环更改源url,将多个spreedsheet复制到一个中

Google apps script importrange使用循环更改源url,将多个spreedsheet复制到一个中,google-apps-script,google-sheets-api,Google Apps Script,Google Sheets Api,我试图使用一个循环来使用importrange,其中包含一个var,但是我得到一个错误,说有一个“公式解析错误” 可以更改url并导入数据。您不能简单地在字符串中插入变量,它会将其作为文本字符串,而不是值变量的值 更改此行: spreadsheet.getCurrentCell().setFormula('=importrange(value, "NOVO FUNIL!A20:T150")'); 为此: spreadsheet.getCurrentCell().setFormula('

我试图使用一个循环来使用importrange,其中包含一个var,但是我得到一个错误,说有一个“公式解析错误”


可以更改url并导入数据。

您不能简单地在字符串中插入变量,它会将其作为文本字符串,而不是
变量的值

更改此行:

  spreadsheet.getCurrentCell().setFormula('=importrange(value, "NOVO FUNIL!A20:T150")');
为此:

  spreadsheet.getCurrentCell().setFormula('=importrange(' + value + ', "NOVO FUNIL!A20:T150")');

它起作用了!谢谢,我真的是一个新的编码,我很确定我忘记了什么,但我看不到。。rsrs。谢谢你。
  spreadsheet.getCurrentCell().setFormula('=importrange(' + value + ', "NOVO FUNIL!A20:T150")');