Skip to main content
Known Participant
March 29, 2025
Answered

Indesign - Rename Style Object by CSV in

  • March 29, 2025
  • 1 reply
  • 651 views

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?

Correct answer Robert at ID-Tasker

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 😉 

 

1 reply

Robert at ID-Tasker
Legend
March 29, 2025

Yes, it's perfectly doable. 

 

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

 

RYR9Author
Known Participant
March 29, 2025

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).

Robert at ID-Tasker
Legend
March 29, 2025

Can you post script you have? 

 

It could most likely do 2in1.