RamblingCookieMonster / PSExcel

A simple Excel PowerShell module

Home Page:http://ramblingcookiemonster.github.io/PSExcel-Intro/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After import empty rows are getting processed

Paul-dH opened this issue · comments

Hi,

If I import a sheet, and the sheet has been edited (removed a lot of rows, now 30). The count of the rows stays the same as the original (600 lines). The lines are empty and give all sorts of errors.

$Users = Import-XLSX -Path "D:\ImportUsers\Import\ImportUsers.xlsx" -Header LastName, FirstName, DisplayName, UserName, UPN, Groups Write-Host "Number of users: $($Users.Count)" #(shows 600, should be 30)

I've tried to use a check for empty values, but this doesn't help.
$Usercount = 0 Foreach ($User in $Users) {If ($User.Username -or ($User.Username -ne "")) {$Usercount++}}

How can I show the correct number of rows. My workarround is to create a new sheet in the workbook, copy all the content I want and delete the old Sheet.

Thanks for the great efford, the module has saved us a lot of manual work and installations of Office on servers :)