I am trying take a table of data returned from invoke-restmethod and insert it into a database. I am struggling with being able to select specific data columns.
When I use the Invoke-RestMethod I get data returned in the format below.
Col1,Col2,Col3,Col4
data,aaa,bbb,ccc
data,ddd,eee,fff
data,ggg,hhh,iii
However I cannot use Select or expandproperty to only grab specific rows. IE the commands below.
$response = Invoke-RestMethod -Uri $URL -Method Get -Headers $headers
$response | Select col1, col2 | Sort-Object -property col2 -Descending
I have also tried to out-file the data however it looks like it is joining it all as one string.
Col1,Col2,Col3,Col4data,aaa,bbb,cccdata,ddd,eee,fffdata,ggg,hhh,iii
Any help is appreciated. Thanks!