1

I'm trying to export a range of cells to a csv file:

#Specify Range
$range = $sh_in.Range("E7:F13,B17:C25").Text

#Export range to csv
$range | Export-Csv "delivery-note\del_note_csv_test.csv" -NoTypeInformation

If I take off the .Text from the Range I get a huge amount of information, including the content of the cells, and I've tried replacing .Text with the header of the info I want, but this just gives an error. What can I do differently?

1 Answer 1

2

Use Select-Object to select what you want (i.e. the Text property) from the returned $range array, then export to the CSV file:

$range = $sh_in.Range("E7:F13,B17:C25")
$range | select text | Export-Csv "delivery-note\del_note_csv_test.csv" -NoTypeInformation
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.