I have a script to convert Excel file to Google Spreadsheet. When I execute the script from within the script editor it works perfectly fine but when I set a time-driven trigger it fails over and over with the error below.
The following object could not be retrieved: the iterator has reached the end. at convertExceltoGoogleSpreadsheet (Excel_Convert: 4)
Hope someone can help me out on this. Thanks in advance!
var dstFileId = '1PUXjW0fxR66...........'; // file Id of Existing Spreadsheet
function convertExceltoGoogleSpreadsheet(fileName) {
fileName = fileName || "test_ds.xlsx"; // excel_file_name.xlsx = name of specific Excel file
var excelFile = DriveApp.getFilesByName(fileName).next();
var fileId = excelFile.getId();
var srcFileId = fileId; // file Id of Excel file
Drive.Files.update({}, dstFileId, DriveApp.getFileById(srcFileId))};