Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import-Excel 7.8.9 - Export Excel file with AutoSize function #1634

Open
bovirus opened this issue Sep 7, 2024 · 3 comments
Open

Import-Excel 7.8.9 - Export Excel file with AutoSize function #1634

bovirus opened this issue Sep 7, 2024 · 3 comments

Comments

@bovirus
Copy link

bovirus commented Sep 7, 2024

My scope is to create an Execl file as table with columns autozize 8adapt column size to larger data vailable)

If I use a funcion like

Export-Excel -Path ExcelFile.xlsx -TableName Table1 -AutoSize"

I create a file ExcelFile.xlsx and openiong it I can check that the coumn size is not set automatically because if I sue in execl columns autozie the column are larger,.

What's the matter?

@dfinke
Copy link
Owner

dfinke commented Sep 7, 2024

need to see the data, script and what OS you are working on

@bovirus
Copy link
Author

bovirus commented Sep 8, 2024

@dfinke

OS: Windows 10 22 H2 64bit italian

Scope of this process

open a csv
sort csv on some fields
remove some fierdls (tarspose)
save it as Excel table

test.zip

The xlsx file created, opened with Execl 2013 and set column autozise have a larger columns.

If you have any sugegstion thanks.

@dfinke
Copy link
Owner

dfinke commented Sep 8, 2024

which columns have the issue?

-AutoSize is best guess. When the xlsx is opened, the cells are rendered and the font can result in the column widths being off.

$xlpkg = $data | Export-Excel test.xlsx -AutoSize -PassThru

Set-ExcelRange -Worksheet $xlpkg.Sheet1 -Range "C:C" -Width 22
Set-ExcelRange -Worksheet $xlpkg.Sheet1 -Range "E:E" -Width 32

Close-ExcelPackage $xlpkg -Show

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants