I have two spreadsheets, SpreadSheetA and SpreadSheetB.
I am trying to get a list of the names of all the sheets in SpreadSheetA and add it to the
Try the below...
function getSheetNamesAndAddToOtherSheet() {
var spreadSheetAURL = "https://docs.google.com/spreadsheets/d/UNIQUE-ID-HERE/edit";
var spreadSheetsInA = SpreadsheetApp.openByUrl(spreadSheetAURL).getSheets();
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
for (var i = 0; i < spreadSheetsInA.length; i++) {
sheet.appendRow([spreadSheetsInA[i].getName()])
}
}