0

我想SpreadsheetApp.create();通过和 IMPORTRANGE 创建一个工作表并在这个新生成的工作表中填写一个查询,cell.setFormula以获取另一个工作表的数据。

它不起作用,因为床单没有连接。如果我手动这样做,则 QUERY 有效。

有没有办法通过脚本连接两张纸?

4

1 回答 1

0

您可以通过 ID 创建一个带有工作表位置的变量。然后,通过脚本远程访问工作表。保存单元格变量并将其粘贴到第一张表中。

伪代码示例

Sheet1 = SpreadsheetApp.getSheetByID('IDofSheetOne');
SpreadsheetApp.create();
Sheet2 = SpreadsheetApp.getSheetByID('IDofSheetTwo'); // the one just created, you'd probably have to use some kind of get to get this ID.

现在从这里开始,您可以说 Sheet1.doWhatever() 和 Sheet2.doWhatever()。

这就是您一次可以访问多个工作表的方式。

于 2016-09-26T14:24:24.580 回答