So I am working on a project where I have a google doc that connects to a spreadsheet, and I added two other sheets that I want to populate with information from the first spreadsheet. I want to do this in the Script Editor but I am having trouble referencing the other tabbed sheets. This is what I've tried.
var tabs = [
'Sign In',
'Master Info',
'Made Sheet'
];
var i = 0;
var sheet = ss.getSheetByName(tabs[i]);
var range = sheet.getRange(1, 1).getValues();
Logger.log(sheet);
Logger.log(range);
The outputs I get are:
sheet
Time Stamp
"Time stamp" is the first cell in the sheet so I can reference the value but not the name of the sheet or any other index that isn't i = 0; Any help is appreciated, or sources on how the tabbed sheets can interact.
This is what I've done so far and am confused as to why I get null for the second sheet even though the name can be printed and it is populated with data.
var sheet = ss.getSheetByName(tabs[0]);
//sign in sheet variable
var sheet1 = ss.getSheetByName(tabs[1]);
Logger.log(tabs[0]);//works
Logger.log(tabs[1]);//works
var A1Value = sheet.getRange(1,1).getValue();
var signIn = A1Value;//gets first cell
var secondVar = sheet1.getRange(1,1).getValue();//error occurs