Skip to main content
Known Participant
Mar 29, 2025 4:56 PM UTC
Answered

Indesign - Rename Style Object by CSV in

Hello,

Do you know if there is an Indesign script that can rename 
object styles (taking into account different groups and subgroups) in bulk from a defined list (e.g. a CSV)?

CSV as:
STYLES:GROUP_1:GROUPE_2:GROUPE:3:MY_STYLE  tab  STYLES:GROUP_1:GROUPE_2:GROUPE:3:MY_NEW_STYLE

It's possible?

Robert at ID-Tasker
Robert at ID-TaskerCorrect answer
Legend
Mar 29, 2025 10:21 PM UTC

Yes, I have Excel installed and I know how to use it. I specialize in EasyCatalog automation but script writing is my weak point.

Sorry if my tense seems dry, English is not my language. 🙂 


quote

Yes, I have Excel installed and I know how to use it. I specialize in EasyCatalog automation but script writing is my weak point.

Sorry if my tense seems dry, English is not my language. 🙂 


By @RYR9

 

Great.

 

No worries, your English is perfectly fine - for me at least 😉 

 

Instead of a script that will read new names from the CSV file and process them in a loop, bla bla bla 😉 - you can generate script in Excel - and then just run it 🙂 

 

In JS, to rename a style - in a group, one level deep - you would have to do something like this: 

 

app.activeDocument.objectStyleGroups.item("level1").objectStyles.item("old_name_1") = "new_name_1";

 

For 2x levels: 

 

app.activeDocument.objectStyleGroups.item("level1").objectStyleGroups.item("level2").objectStyles.item("old_name_1") = "new_name_1";

 

I hope you get how 3rd level would look like 😉 

 

So, in Excel, you would've to create a spreadsheet, that will use data from your CSV file - and will build lines like the above - using concatenate().

 

Just remember that your names need to be enclosed in " ". 

 

Then: 

 

https://creativepro.com/how-to-install-scripts-in-indesign/

 

I hope my explanation is clear enough 😉 

 

I just prefer simple solutions 😉 

 

10 replies

Robert at ID-Tasker
Legend
Mar 29, 2025 7:07 PM UTC

Yes, it's perfectly doable. 

 

Only the name of the ObjectStyles or groups / folders as well? 

 

Translate
RYR9Author
Known Participant
Mar 29, 2025 8:46 PM UTC

Just rename the name of objects styles.
Sometimes, the objects styles may have identical names in differents groups.

STYLES:GROUP_1:GROUPE_2:GROUPE_3:MY_STYLE 
→ STYLES:GROUP_1:GROUPE_2:GROUPE_3:MY_NEW_STYLE

STYLES:GROUP_1:GROUPE_1:GROUPE_5:MY_STYLE 
→ STYLES:GROUP_1:GROUPE_1:GROUPE_5:MY_NEW_STYLE

…

 

I need to re-adapt names to use a script (already written) that swaps object styles (horizontal or vertical presentation).

Translate
Robert at ID-Tasker
Legend
Mar 29, 2025 9:00 PM UTC

Can you post script you have? 

 

It could most likely do 2in1.

 

Translate