Reputation: 2172
Is there a way to generate an excel spreadsheet using PowerShell without using a Com Object? I have a few really ugly scripts that open an Excel Com Object, add data, run some macros, and save the file to create reports I need. If I could define spreadsheet formatting, then convert a csv to that format using PowerShell, I assume it would be faster, and an overall better script. How could I do that? Is it possible?
Upvotes: 0
Views: 3761
Reputation: 200453
Are the workbooks .xls
or .xlsx
files? The latter are basically a bunch of XML files in a Zip archive, so you could extract the XML files from the archive and proceed from there. If you need to hand-craft a .xlsx
file this posting on visualbasicscript.com may help.
Upvotes: 2
Reputation: 28194
If you are satisfied with accessing the raw data in the spreadsheet/workbook, dumping it to CSV, and/or doing some additional processing outside Excel, see this answer for getting started with accessing the data via ODBC & System.Data
.
Upvotes: 0