'Powershell - Import-Excel without hidden rows

How do I import an Excel .xlsx file into a Powershell without blank rows? I use Import-Excel to import a file. Just want to import non-hidden rows from the file.

I tried to filter with where-object, like in case blank rows and with out-gridview. Unfortunately, hidden values are imported every time.

    # Get all workbook sheets
    $sheets = Get-ExcelSheetInfo -Path $path
    # Get from all workbooks sheets data
    $Report = @()
    foreach($sheet in $sheets){
     if($sheet.Hidden -eq "Visible"){

     $Report += Import-Excel -Path $Path -WorksheetName $sheet.name | Where-Object { $_.PSObject.Properties.Value -ne '' } | Out-GridView -Title "Select rows to pass" -PassThru
           
       }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source