How to know if a sheet was already created?

19 views
Skip to first unread message

Plácido Antônio Langer Reinert

unread,
Mar 5, 2020, 11:32:26 AM3/5/20
to Google Apps Script Community
I'm trying to create a sheet who will works like a Database for a couple of data getted of the Gmail (My sidebar will works just on Gmail).
But before i create a new sheet for that, i have to look if the sheet already exist. If exist i want to save on the sheet existent.
How can I do that?

Alan Wells

unread,
Mar 5, 2020, 1:46:31 PM3/5/20
to Google Apps Script Community
You can search by mime type and file title


var title = "Enter file name here";

var files = DriveApp.searchFiles('mimeType contains "spreadsheet" and title contains "' + title + '"');

while (files.hasNext()) {
 
var file = files.next();
 
Logger.log(file.getName());
}


Reply all
Reply to author
Forward
0 new messages