Hi everyone, I need a function that will allow me to quickly clean up the empty rows in an xlsx. I currently have a function that does the job, but does so incredibly slowly considering there are over 1Mil empty rows, compared to about 8k rows of actual
data. Any help with this issue would be greatly appreciated. I've included the current bit of code for reference.
$sheetRange = $sheet.UsedRange
$sheetrowCount = $sheetRange.Rows.Count
#Cleanup Empty Rows
$max = $sheet.UsedRange.Rows.Count
for ($i = $max; $i -ge 6; $i--) {
if ($sheet.Cells.Item($i, 1).Text -eq '') {
$heetRange = $sheet.Rows.Item($i).Delete()
}
}