I am trying to load an collection object using LoadfromCollection into an excel file. I am using EPPLUS library to do so. But I keep on receiving the error "Cannot find an overload for "LoadFromCollection" and the argument count: "1"." Since I am a newbie to PowerShell, not sure how to resolve the issue. Also, is there any other way around to load collection object using EPPLUS library?
$pkg = [OfficeOpenXml.ExcelPackage]::new($Path)
$ws = $pkg | Add-WorkSheet -WorkSheetname 'test'
$DemoData = New-Object System.Collections.ArrayList
$DemoData = 1..10 | Foreach-Object{
$BookID = Get-Random -Minimum 1 -Maximum 1000
$Date = (Get-Date).adddays(-$BookID)
New-Object -TypeName PSObject -Property @{
Name = "Book$_"
BookID = $BookID
Date = $Date
} | Select Name, BookID, Date
}
$null = $ws.Cells['A1'].LoadFromCollection($DemoData)