[英]Cannot get ranges from multiple sheets in google apps script
I'm trying to run a short section of my code that gets 2 ranges off of one spreadsheet, 1 range off of another, and create a new sheet. 我正在尝试运行我的代码的一小段内容,即从一个电子表格中缩小2个范围,从另一个电子表格中缩小1个范围,然后创建一个新工作表。 The code I am using is as follows:
我使用的代码如下:
var names = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Availability").getRange(2, 2, 19, 1);
var availability = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Availability").getRange(2, 2, 19, 6);
var needs = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Needs").getDataRange();
var staffingSheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet("Staffing");
When I change the order of the first three lines I get errors on different lines and different calls but they are all TypeError: Cannot read property "0.0" from undefined.
当我更改前三行的顺序时,在不同的行和不同的调用上会出现错误,但它们都是
TypeError: Cannot read property "0.0" from undefined.
Oddly enough, when the staffingSheet already exists, no errors are thrown by the first three lines but an error is caused by the existance of the sheet its trying to create. 奇怪的是,当staffingSheet已经存在时,前三行不会引发任何错误,但是由于尝试创建的工作表的存在而导致了错误。 Anyone have any ideas?
有人有想法么?
Redian resolved it. Redian解决了它。 There were no errors, the problem was in other code section.
没有错误,问题出在其他代码部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.