简体   繁体   中英

Google Apps Script doesn't find file

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM