I have an InDesign CC 2018 document which I imported a docx file. The file contains a lot of tables. I want to apply a table style to all of the tables, but we are talking hundreds of tables.

Is there a script that will select tables and apply a specific style?

Or is there a way to apply table styles to all tables in a document at once?

Thanks in advance

1 Answer 1


Ok, I think I can answer my own question, and leave it as a reference for others who might be looking for a solution.

To apply a Table Style and Clear All Table Style and Cell Style Overrides on all tables within a document use this script:

for (s=0; s<app.activeDocument.stories.length; s++)  
for (t=0; t<app.activeDocument.stories[s].tables.length; t++)  
     app.activeDocument.stories[s].tables[t].appliedTableStyle = "TableStyleNameGoesHere";  

// Clear All Overrides

var allStories = app.activeDocument.stories.everyItem();

// Remove overrides from all footnotes
catch (e){alert ("No footnotes!")}

// Remove overrides from all table
catch (e){alert ("No tables!")}

// Remove overrides from all cells
catch (e){alert ("No tables!")}

alert("Overrides cleared!"); 

This worked for me. Hopefully it will work for you.

  • allStories.footnotes.everyItem().texts.everyItem().clearOverrides(myOverrideType); What is myOverridesType? Commented Mar 13, 2020 at 10:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.