• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Ccreating files with different name and size with an excel file

Community Beginner ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

Hi everyone I need to create a large a mount of illustrator files for a big event.
I need multiple files with different sizes, every file I need can only support one artboard because the are pretty big. 
Can I create every file at once using an excel/scripts or do i need to create every file one by one?

 

My table have only two varibles 
Name  |   Size    |

TOPICS
Import and export , Print and publish , Scripting , Tools

Views

185

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jun 29, 2022 Jun 29, 2022

I'm not sure how to access an excel file directly from within an Illustrator script but if you can export your excel file to a CSV file then the below script should create the documents for you. If you need to create lots of documents you may need to do them in chunks but this should get you started. I have attached a sample Excel file and the corresponding CSV file for reference.

 

A few notes:

  • Sizes in my Excel/CSV file are in inches
    • that's why the script multiples them by 72
    • if the doc sizes are r
...

Votes

Translate

Translate
Adobe
Community Beginner ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

These files will go to a printing house, thats why they need to be so specific

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

I'm not sure how to access an excel file directly from within an Illustrator script but if you can export your excel file to a CSV file then the below script should create the documents for you. If you need to create lots of documents you may need to do them in chunks but this should get you started. I have attached a sample Excel file and the corresponding CSV file for reference.

 

A few notes:

  • Sizes in my Excel/CSV file are in inches
    • that's why the script multiples them by 72
    • if the doc sizes are really large this may cause an issue due to scaleFactor
  • My sizes are separated by an `x`
    • If you use something else to separate them then `.split("x")` would need to be changed
  • If your file names are weird, excel may put quotation marks around the file name so the script would need to be adjusted to account for that
  • You may need different document presets than the what I used

 

Hope this helps!

 

// put the path to your exported csv here
var file = new File("~/path/to/your/file/filesInfo.csv");
// read in the csv data
var fileData = loadFileData(file).split("\n");
// set the print preset you want to use `Print` in this case
var printPreset = app.startupPresetsList[0];
// iterate over the lines in the csv file and make the docs
var docPreset, doc, parts, name, size;
for (var n in fileData) {
  // split out data for specific line in csv file
  parts = fileData[n].split(",");
  name = parts[0];
  width = parts[1].split("x")[0];
  height = parts[1].split("x")[1];
  // set up a doc preset so we can change name
  var customPreset = new DocumentPreset();
  customPreset.colorMode = DocumentColorSpace.CMYK;
  customPreset.title = name;
  customPreset.width = width * 72;
  customPreset.height = height * 72;
  // create the document
  app.documents.addDocument(printPreset, customPreset);
}

// load file data if available
function loadFileData(file) {
  if (file.exists) {
    try {
      file.encoding = "UTF-8";
      file.open("r");
      var data = file.read();
      file.close();
      return data;
    } catch (e) {
      alert("Sorry, error loading file " + file + "!");
    }
  }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

LATEST

Thanks you so much, I will try this

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines