Skip to main content
joshuab22185620
Participating Frequently
March 24, 2021
Answered

Script to rename artboard based on excel list or text doc

  • March 24, 2021
  • 7 replies
  • 4039 views

I was wondering if it is possible to create a script that renames the artboards based on an excel, or text file. Instead of having to double-click and type out each name.  I hope this makes sense. 

Correct answer Kristine26469629c8ap

Hi! I am new to using scripts... I keep getting the alert "You have too few names." But I'm not sure what to change to fix that. I tried having the same number of artboards as my end goal (and the number of lines in my text file)... but... I'm not sure how to understand where my error is. Any suggestions would be much appreciated!

7 replies

Participant
February 21, 2025

Is it possible to use a similar code for Photoshop? I want to change the names of multiple artboards using a .csv.

Please and thank you!!

femkeblanco
Legend
March 24, 2021
var file1 = File.openDialog("Select text file", "*.txt");
file1.open("e");
var contents1 = file1.read();
file1.close();
var contents2 = contents1.split("\n");
for (var i = 0; i < app.activeDocument.artboards.length; i++) {
    if (contents2[i]) {
        app.activeDocument.artboards[i].name = contents2[i];
    } 
    else {
        alert( "You have too few names." );
        break;
    }
}
joshuab22185620
Participating Frequently
March 24, 2021

@femkeblanco  This is flawless, thanks

pixxxelschubser
Community Expert
Community Expert
March 24, 2021

There is no screenshot available and no ai sample to test.


And yes, this is the general way the script should be programmed.

For example, you can find the number of artboards with:

 

var aDoc = app.activeDocument;
alert (aDoc.artboards.length);

 

 

joshuab22185620
Participating Frequently
March 24, 2021

I have a little experience, but not enough to anything like this. 

I already fixed it on the project i wanted it for, but would the script have to be specific to each project? or could you somehow get the number of artboards (X) and then grab X number of lines from the file and then apply the lines as the names? 

 

I'll attach what i wanted it for. I attached the artboard panel screenshot, and then the txt file i wanted it to grab from.  

pixxxelschubser
Community Expert
Community Expert
March 24, 2021

Like a wrote before: "… too little information and/or descriptions…"

Give us an example list (CSV or TXT) an example file (AI)  and/or a screenshot of your Artboards Panel.

 

Do you have experience writing scripts yourself? Do you need only help with scripting? For this, the Forum is here. Or do you need someone to write the script entirely for you?

pixxxelschubser
Community Expert
Community Expert
March 24, 2021

Yes. It is possible.

You can check a few of the answered threads in the link that I have posted before.

 

I am very sure you will find something suitable there already.

joshuab22185620
Participating Frequently
March 24, 2021

I found something that works, it doesn't do exactly what I was hoping, but it is a start. It just brings up a dialog box for me to type in the name, which is faster than double-clicking each artboard but would still like to see if someone could come up with a script for this. 

 

Thanks

pixxxelschubser
Community Expert
Community Expert
March 24, 2021

Hi @joshuab22185620 

For the beginning. (too little information and/or descriptions)

--> Illustrator forum search | Rename artboards script

joshuab22185620
Participating Frequently
March 24, 2021

@pixxxelschubser  sorry i dont really know how to explain it.

 

I have a list of names in an excel sheet, and i want Illustrator to take those names and apply them to the names of the artboards in illustrator in the order they are. Is that possible?