Reputation: 2595
I have a script, which overwrites daily a Google Drive file (Google Spreadsheet) with new data. On overwriting, the file name remains the same, but the file ID changes.
I want to access the file with a Google App script scheduled daily with a time trigger to remove each daily portion of data into another file, so I'm able to make a time series report.
I know how to do this - but the method I know will work only if the file ID remains always the same - so I can't use this known method.
How can I access the file while knowing only its file name, which remains always the same, without knowing the the file ID?
Upvotes: 0
Views: 1459
Reputation: 9571
I suggest you update the script that overwrites the file to just update the file. Then it's always the same file.
If that's not possible, you can search for the file using DriveApp.getFilesByName()
. If you happen to know exactly which folder the file will be in, then you can narrow your query results by using Folder.getFilesByName()
.
Upvotes: 2