I am trying to figure out how to get data from a Spreadsheet bounded to a script that is referenced as a package in another script.
I have a Spreadsheet with some data and a bounded script with this function:
function getIt()
{
return SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("A1").getValue();
}
The script works as expected.
Then I have a standalone script/project where I have added the above script as a library. In this standalone script, if I try library.getIt() I get an error:
TypeError: Cannot call method "getSheetByName" of null. (line 8, file "Code", project "Untitled project")
What I want to do is create some functions in the script that is bounded to the Sheet that gets/returns data from the sheet. Then I want to be able to add the script as a library to other scripts and get said data by calling those functions.
Is this possible?