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-Excel reads null values with PowerShell 7.4.0

mcqueene opened this issue · comments

Has anyone tested Import-Excel with the latest version of PowerShell 7.4.0? I just updated and when working with existing scripts every value returned is null. I tested using the example located here and it returns a measure count of zero. Can anyone try the example and see if they get different results? Here's the code I used (Excel file is located in Github examples).

$xlfile = "C:\no_backup\yearlySales.xlsx"
$result = Import-Excel -Path $xlfile -WorksheetName * -Raw
Write-Host $result.Count
$result | Measure-Object

I have 7.4 preview at the moment. Looks ok. Maybe 7.4 GA has an issue

image

FYI - rebooting didn't fix the issue, not that I expected it would. Also note that my $r.count command does show 1200 records, but the Measure-Object command shows zero because each row is null/empty.

Also note that I found another script that seems to have broken. It was an import step reading from an existing Excel file and loading that into a worksheet. If I can recreate this using your sample data I will make a separate post. I just wanted to throw that out there in case others start to see issues.

I can’t repro. So don’t know

Working on some other code I bet it is related to this custom object issue which I will try to test.

I did a test and if I insert $ExecutionContext.SessionState.LanguageMode = 'FullLanguage' into the top of the function it works again. I assume this is a setting change from my organization and not a result of the new version of PowerShell so I will close the issue.