Reputation: 121
I have a Spreadsheet of Multiple Sheets, I need in cell A1 (or any cell) to display the name of that Sheet (just like with SheetZ then cell A1 SheetZ
and Sheet123 then cell A1 is Sheet123
and cells the rest are not deleted). And I will add Trigger OnChange, it will update automatically if I add a new sheet. Thanks everyone for reading!
For example
Upvotes: 0
Views: 439
Reputation: 64032
List of Names:
const names = SpreadsheetApp.getActive().getSheets().map(s => s.getName());
Names in A1 of each sheet:
function myfunc() {
SpreadsheetApp.getActive().getSheets().forEach(s =>{s.getRange('A1').setValue(s.getName());});
}
Upvotes: 1