Reputation: 87
I just want to check, if a file already exists on my Google Drive:
var Filename = 'xyz';
var Files = DriveApp.getFilesByName(Filename);
if (Files.hasNext()) { ... }
This did work very good for some month. But suddenly it stopped working a few weeks ago. Now the result of hasNext() is always false - although the filename definitely does exist.
Did anything change at Google Apps Script? Is anything wrong with my code? Can I fix it?
Upvotes: 1
Views: 1576
Reputation: 201603
Finally, I found how to retrieve files with filename included umlauts. Please confirm this. title contains
was required as a query. It was not title=
. Please confirm the following script for your script.
var name = "Übergabe News";
var Files = DriveApp.searchFiles('title contains "' + name + '" and trashed=false');
if (Files.hasNext()) { ... }
Also you can use this for "20170817 Nachrichten-Übergabe" in your comments. I'm sorry for being late solution.
Upvotes: 2