I have a large excel file that is used to aggregate tracking for issues across multiple clients and I need to divide it into smaller files based on the clients.
Here’s what I’ve got so far: I’ve built a python script that divides the file into the appropriate client-specific files and applies the correct header row to all of them, but it produces CSVs which are ugly. My boss wants to apply some formatting, so what I need to do is (for all CSVs in the directory):
-
convert each file from CSV to .xls (or .xlsx) so it will hold the formatting
-
Auto-fit column widths
-
Make the first row bold (and perhaps apply a color to the row)
So far I’m guessing I can probably do this with either pyWin32 or pyExcelerator, but considering how minimal the changes I’m looking to make are it may be easier to do this as a VB script or a macro or something, but I don’t really know those tools.
The simplest way would be to use
VBAHere’s a quick macro to loop thriugh a folder of csv’s open, apply autofit and save as
.xlsxNote: