Answer the question
In order to leave comments, you need to log in
How to check google script if there is a sheet with the same name in the table as the active one?
How to check with google script code if there is a sheet with the same name in the table as the active one?
Answer the question
In order to leave comments, you need to log in
Most likely, you want to check if there is a sheet with the given name in the workbook. Just take this sheet - it will immediately become clear - it is or it is not.
Example
const sheetName = 'Sheet1';
const sheet = book.getSheetByName(sheetName);
if(sheet){
cnsole.log(`Лист с именем ${sheetName} есть`);
}
const sheetName = 'Sheet1';
const sheet = book.getSheetByName(sheetName) || book.insertSheet(sheetName);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question