I tried to shorten the basic codes of gs.
function quantityAnalysis (){
var subscription = magicSheet("dataRaw","Subscription");
var idCol = msCol(subscription,"Subscription Id");
var xlCol = msCol(subscription,"XL");
var goCol = msGoCol(idCol,xlCol);
var lastRow = msLastRow(subscription);
var dataToFilter = subscription
.getRange(1,idCol,lastRow,goCol)
.getValues();
}
**In the second file **
function magicSheet (ssName,sheet="full"){
//return sheet
let id = sMagicSearch("id",ssName);
if(sheet=="full"){
return SpreadsheetApp.openById(id);
}else{
return SpreadsheetApp.openById(id).getSheetByName(sheet);
}
//end return sheet
}
It was working till I did this.
var subscription = magicSheet("dataRaw","Subscription");
function quantityAnalysis (){
var idCol = msCol(subscription,"Subscription Id");
var xlCol = msCol(subscription,"XL");
var goCol = msGoCol(idCol,xlCol);
}
Error: magicSheet is not defined.
one more thing to tell : subscription function is used in one more function to print values to the sheet ;
(function calling from another file to a function is working , but calling the same one as a global varible is not working ).