質問

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. 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. 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. Anyone have any ideas?

役に立ちましたか?

解決

Redian resolved it. There were no errors, the problem was in other code section.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top