@Mike – if you think in scripting this, I would totally avoid using Table Styles.
Instead *only* using Cell Styles. If the logic of applying Cell Styles is clear – and I think in this case it is – one can write a script that can do that, independent how many rows or columns are present.
On the other hand, you could use a PlugIn e.g. from Woodwing, SmartStyles, that could save the table logic as a Library element, that could be applied to a table.
What is also possible (without scripting or buying a plug-in):
Format a table in advance. This is done in a few minutes. You do not need cell styles for that.
Then copy/paste the contents over the clipboard from Excel to InDesign when the table is selected.
Uwe
To elaborate on my last statement:
If you do not have the contents of the table available in Excel, just select the table in InDesign, copy/paste to your text editor (it is alright to use TextEdit on a Mac), and then copy/paste the text from TextEdit on to *one* cell in Excel. Excel is smart enough to built a table with the right contents in the right order.
Then do your formatting of the table in InDesign:
copy/paste rows as much you like, so that you have a really large table (in the moment with the wrong contents).
After that select the Excel table and copy/paste the contents to your selected InDesign table.
The formatting of the text will be that of your pre-defined InDesign table cells.
Uwe
Sans cell styles, this Javascript adds 20% to the tint of cells in the very first column for each table. It does not change header rows (and on 2nd thought, maybe it shouldn't do footer rows either).
.. Without trying, I couldn't tell what happens with complickated merged cells. The document I'm working on contains 8 tables, but the idiotic author pasted them as figures into Word. All of my scripting prowess can't work around that ...
tables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
for (t=0; t<tables.length; t++)
processTable (tables[t]);
function processTable (table)
{
var i, cells = table.columns[0].cells;
for (i=table.headerRowCount; i<cells.length; i++)
{
cells[i].fillTint += 20; // percentage to add
}
}
North America
Europe, Middle East and Africa
Asia Pacific