EGr
EGr

Reputation: 2172

Create/Modify Excel spreadsheet without using a Com Object in PowerShell?

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

Answers (2)

Ansgar Wiechers
Ansgar Wiechers

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

alroc
alroc

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

Related Questions