I'm new to powershell, I want to perform some operations on excel. I'm able to do that by using Com Object. But i dont want to use Com Object , instead of that im trying to use aspose cells dll.
Could you please help how can i import or add this dll in my powershell script.
Below is code by using Com Object , i want to re-write it using aspose dll.
$Source = 'D:\Test'  # the path to where the Excel files are
# create an Excel COM object
$excel  = New-Object -ComObject Excel.Application 
# find Excel files in the Source path and loop through.
# you may want to add the -Recurse switch here if the code should also look inside subfolders
$result = Get-ChildItem -Path $Source -Filter '*.xlsx' -File | ForEach-Object {
    $workBook  = $excel.Workbooks.Open($_.FullName)
    $workSheet = $Workbook.Sheets.Item(1)
    $count     = 0
    $label = $workSheet.Range('$A:$B').Find('*Animal count:*')
    if ($label) {
        # get the numeric value for the cell next to the label
        # empty cells will translate to 0
       $count = [int]$workSheet.Cells.Item($label.Row, $label.Column +2 ).Value()
    }
    # output a PSObject with the full filename and the animal count value
    [PsCustomObject] @{
        'File'        = $_.FullName
        'AnimalCount' = $count
    }
    $workBook.Close()
}
# quit Excel and clean up the used COM objects
$excel.Quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($workSheet) | Out-Null
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($workBook) | Out-Null
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel) | Out-Null
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
# output on screen
$result | Format-Table -AutoSize
#output to CSV file
$result | Export-Csv -Path 'D:\Test\AnimalCount.csv' -UseCulture -NoTypeInformation
e