3 Replies Latest reply on May 19, 2018 5:12 AM by Laubender

    Auto data merge all csv files in folder

    Antony Mooe Level 1

      Hello,

       

      I have a folder with 10 csv files and an Indesign template file.

       

      I need to:

       

      1. open Indesign template file

      2. get all csv files in folder to indesign

      3. merge and record all csv

      4. save indesign files with the cvs names

       

      Is that possible to do?

       

      Thank you Guys!

        • 1. Re: Auto data merge all csv files in folder
          davidc19923048 Level 1

          I think so:

           

          1. open Indesign template file

          var file = new File(templateFolder + "template.indt");
          app.open(file);
          

           

          2. get all csv files in folder to indesign

          for (var i = 0; i < 10; i++) {
               csvName = "csv"+i+".csv";
               csvFile = new File(csvPath + csvName);
          }
          

          3. merge and record all csv

          I didn't understand this

           

          4. save indesign files with the cvs names

          app.activeDocument.save(csvName);
          
          • 2. Re: Auto data merge all csv files in folder
            Antony Mooe Level 1

            Hello davidc19923048,

             

            I'm sorry, but the script it's not working.

            I get the error: "templateFolder is undefined"

             

            In the step 3 you didn't understood, I need to create merged documents.

             

            Thank you very much!

            • 3. Re: Auto data merge all csv files in folder
              Laubender Adobe Community Professional & MVP

              Hi Antony,

              you have to understand that you posted in the Adobe InDesign Scripting Forum where ( mostly ) scripters hang around.

              A snippet like the one by David is showing you just the way to write your own code or is just showing a principle of coding. It seldomly is meant to be a full script that is working in every case, in every occassion on data David cannot see into.

               

              About the error message: Of course it says "templateFolder is undefined.".

              It's your job to define the variable templateFolder so that it is a valid folder path to your data.

              David obviously cannot know where your data is.

               

              Regards,
              Uwe