1 Reply Latest reply on May 30, 2015 11:04 PM by sandeeps24189

    Script for Data merge InDesign CC server 2014

    sandeeps24189

      I am executing following script for data merge operation. Not generating any error, But neither it merge data from csv data source into new indd file.

       

      var myFile = new File("E:/*.indd");

       

      var myDocument = app.open(myFile);

       

      with (myDocument.dataMergeOptions) {

      linkImages = true;

      removeBlankLines = false;

      createNewDocument = true;

      documentSize = 100;

      } // (end of dataMergeOptions)

       

      myDocument.dataMergeProperties.selectDataSource(new File ('E:\Employees.csv'));

      myDocument.dataMergeProperties.mergeRecords();

       

      myDocument.save(new File("E:/*indd"));

      myDocument.close ();

       

       

      I am working on InDesign CC Server 2014 with ExtendScript toolkit.

        • 1. Re: Script for Data merge InDesign CC server 2014
          sandeeps24189 Level 1

          I got it resolved by reffering to app.documents instead of local myDocument variable.

           

          myDocument.save(new File("E:/*indd"));

          REPLACE WITH:

          app.documents.item(0).saveACopy(new File ('E:/*.indd'));

           

          Here comes another scenario:
          Can I put csv records [datasource] into an array & access my data records for custom logic.

           

          myDocument.dataMergeProperties.selectDataSource(new File ('E:\Employees.csv'));

          myDocument.dataMergeProperties.mergeRecords();

          var lstData = app.documents.item(0).dataMergeProperties.getElements();

           

          Above code do not provide any elemnt list. Any script/method to get CSV datasource.