Please I need to customize an excel sheet but I do not know number of columns in my excel sheet. It may be 10 columns or 30 or 40 all depends on user. My question how to access those columns to change the background color
This example here shows how to colour the columns. You can find the number of columns with columns().count() - then iterate through those columns in the spreadsheet.
Well how can I use columns().count()? please if you have an example let me know.
The example you mention
if ($('c[r=C'+x+'] t', sheet).text() === 'London') {
$('row:nth-child('+x+') c', sheet).attr('s', '39');
}
That will color column 'C', I need to select all columns in the excel sheet, so if I have column A, B, C, D, E in excel I need a code that loop over those columns. If I have column A, B, C, D, E, F, G in excel I need a code that a loop over those columns. In short I need code that loop over columns dynamically whatever the number of columns.
Answers
This example here shows how to colour the columns. You can find the number of columns with
columns().count()
- then iterate through those columns in the spreadsheet.Colin
Thanks for reply.
if ($('c[r=C'+x+'] t', sheet).text() === 'London') {
$('row:nth-child('+x+') c', sheet).attr('s', '39');
}
That will color column 'C', I need to select all columns in the excel sheet, so if I have column A, B, C, D, E in excel I need a code that loop over those columns. If I have column A, B, C, D, E, F, G in excel I need a code that a loop over those columns. In short I need code that loop over columns dynamically whatever the number of columns.
This updated example here should help you get that loop going: http://live.datatables.net/sesugofi/1/edit
Colin