dfinke / ImportExcel

PowerShell module to import/export Excel spreadsheets, without Excel

Home Page:https://www.powershellgallery.com/packages/ImportExcel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import Sheet, including all formatting?

RonJohn2 opened this issue · comments

I have a spreadsheet "foo.xlsx" with one worksheet, named "bar". It's multi-column, and is formatted with foreground and background colors, I want to add that worksheet to a new spreadsheet (with multiple worksheets, created via multiple calls to Export-Excel -path "c:\path\to\new.xlsx".

Everything works swimmingly, except that Import-Excel -path "c:\path\to\foo.xlsx") .... loses all formatting. Am I missing something, or does Import-Excel

$ws = Import-Excel -path "c:\path\to\foo.xlsx") -WorksheetName "bar" -NoHeader
$ws | Export-Excel -path "c:\path\to\new.xlsx" -WorksheetName "bar" -AutoSize

Honestly, except for for the missing formatting on this one worksheet ImportExcel has made this spreadsheet generation task much easier.

@RonJohn2 thanks for using the module

Import-Excel only imports data. Doing formatting is far too big a task. - Sorry

Copy-ExcelWorkSheet is what I was looking for. (I'm new to PowerShell and the Windows programming "mindset", so still working out how to discover a modules features.)

Copy-ExcelWorkSheet copies formatting? I scanned that before responding and didn't remember if it implemented formatting.

Guess it does. It copies the sheet structure.

Haven't used that in a long while. :)