I am trying to find an app script solution to automatically import an Excel file into my Google Sheet each morning. I have found a number of examples on this forum as to how to import an Excel file however I have two challenges that I have not been able find a solution for:
The filename of the Excel sheet I need to import changes daily as it is an inventory report from the night prior and the filename is based on the date and time the report was run.
Only the first 10 of the 14 characters of the filename are predictable. The filename is always "IV" followed by the year, month, day and the time the report ran however the time that the report runs is not consistent. For example IV201907142308.xls means the report ran July 14, 2019 at 11:08pm however the night before the report ran at 11:04pm.
Possible workaround:
Instead of trying to import an Excel file from a specified folder by matching only part of the filename I could have another sheet that runs a script listing all files in a folder and the link to each file and have the import Excel file script refer to that list in order to find the link to the correct Excel file. I can create the list all files script but I am not sure how to have the import Excel file script refer to a link on the sheet in order to upload the correct Excel file.
How do I solve the problem?