I want to extract a range of cells from an Excel sheet and output them in CSV form for further use. So far I have written this:
script.ps1
:
$excel = New-Object -ComObject Excel.Application
$WB = $excel.Workbooks.Open('c:\users\me\desktop\temp\nouveau dossier\superstore.xls')
$WS = $WB.Sheets.Item(1)
$data = $WS.Range("A1", "E10")
$data | select text | Export-Csv 'YATry.csv' -NoTypeInformation -Delimiter ';'
$excel.Quit()
but what I get is this:
"Text" "Row ID" "Order ID" "Order Date" "Ship Date" "Ship Mode" "1" "CA-2016-152156" "2016-11-08" "2016-11-11" "Second Class" "2" "CA-2016-152156" "2016-11-08" "2016-11-11" "Second Class" "3" "CA-2016-138688" "2016-06-12" "2016-06-16" "Second Class" [...]
What am I missing?