vendredi 11 septembre 2015

DriveApp.getFileById returns cannot find PDF

I've been using the below coding for months with no problems. But this month, I am getting a return of a message that the PDF file cannot be found. I checked the execution transcript and it does find the files but gets stuck with the below coding. Can you help me to correct this issue?

//uses the excelFiles (name of file) to get the unique ID for each so that Gmail app can attach to each email     
    while (excelFiles.hasNext()) {
      var excelFile = excelFiles.next();
      var excelFileIds = (excelFile.getId());
      var excelAttachFiles = DriveApp.getFileById(excelFileIds);
    };
  //uses the pdfFiles (name of file) to get the unique ID for each so that Gmail app can attach to each email  
    while (pdfFiles.hasNext()) {
      var pdfFile = pdfFiles.next();
      var pdfFileIds = (pdfFile.getId());
      var pdfAttachFiles = DriveApp.getFileById(pdfFileIds);
    };

   //if the pdf and excel file match vendor number, then Gmail will send email with both attachments and will log a 'Success!'
    if (pdfFile == "V" + vendorNumber + " P" + period + " 2015 Import Retail.pdf" && excelFile == "v" + vendorNumber + ".xlsx") { 
    Logger.log("V" + vendorNumber + " Success!");

    sentWithoutException.push(vendorNumber);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire