Web-Request to CSV with multiple columns RRS feed

  • Question

  • Good Day, I'm very new to Powershell and I have been task with gathering some data from web sites and exporting to Excel. I need some serious Help, Please! Excel displays "System.Object[]"

    Here's one of many scrips so far.

    $Date = $test.ParsedHtml.getElementsByTagName("div") | Where {$_.className -eq "entry-date"} | Select outertext
    $Descrp = $test.ParsedHtml.getElementsByTagName("div") | Where {$_.classname -eq "field-content"} | Select innertext
    $Links = $test.ParsedHtml.getElementsByTagName("a")  | Where {$_.href -like "*current-activity/2020*"}| Select pathname #ForEach-Object -MemberName pathname
    $testObject = New-Object PSObject
    $testObject | add-member NoteProperty "Date" $Date
    $testObject | add-member NoteProperty "Descrp" $Descrp
    $testObject | add-member NoteProperty "Link" $Link
    $testObject | Export-Csv -NoTypeInformation -path C:\Users\dir\APITest6.txt

    Tuesday, February 18, 2020 8:34 PM

All replies

  • You cannot export arrays. All elements you have retrieved are arrays.

    Take the time to inspect what you have and decide how you have to handle it.



    Tuesday, February 18, 2020 8:41 PM
  • Ok, Thank You!
    Tuesday, February 18, 2020 8:56 PM