0 Replies Latest reply on Nov 5, 2015 5:34 AM by BEGINNER_X

    Read Excel

    BEGINNER_X Level 3

      HI All,

      1. Excel Report write by User Interface.

      2. Finally Excel will created by UI and Indesign file.

       

      Request:

      1. Read the excel, if the column heading, "Job Number & Media Type" already existing in the Excel, then no need to write

      2. If the column heading, "Job Number & Media Type" is not in the excel, then need to write the data in the next line.

       

      Hope, this is difficult to understand my request. But please help and get back in case of any concerns.

       

      Output Excel Screenshot:

      Screen Shot 2015-11-05 at 12.39.19.png

       

      Trying code:

      
      
      var mySourceFolder = Folder("/Users/AAAA/Desktop/QC_CheckList/Testing/");     //Path Declaration
      myFile = new File(mySourceFolder + "/" + "AAA_QC_CHECKLIST.xls");      //Excel File Naming Declaration
      
      if(myFile.exists) {
          var dup = myJobNumber_Final + "";     //Created by UI, (this should varies)
          var dup1 = mymedia_Type + "";         //Created by UI, (this should varies)
          myFile.open('r');   
          var myFind = myFile.read();
          var myLine = String(myFind.split(","));
          var dupControl = myLine.indexOf(dup);
          alert(dupControl)
          var dupControl1 = myLine.indexOf(dup1);
          alert(dupControl1)
          if(dupControl == -1 && dupControl1 == -1)
          {
          myFile.open("e");
          myFile.seek(0, 10);
          myFile.write(currentDate + "\t" +  myIST_CurrentTime +  "\t"  + "DEPARTMENT" + "\t" + "YYYY_ADAP" + "\t"  + myJobNumber_Final +'\t' + myFinal_Version +  "\t" + myVersion_Suffix +"\t" + myInternal_Rej + "\t"  +myExternal_Rej + "\t" + mymedia_Type + "\t" + "TTTT" +
          }
      }