Empty Coder
Empty Coder

Reputation: 589

Append csv file to existing excel as new sheet

Below is the csv data I have

Index
-----
10.01.01.01
10.02.02.02
10.03.03.03

Tried like below and it is working fine

Import-Csv -Path "C:\Scripts\Index.csv" | Export-Excel -Path "C:\Scripts\IPReports\ipaddress.xlsx" -WorkSheetname 'Index'

But the sheet is getting added at the end.I want to add this as first tab

Note: I don't have excel installed in server. using Importexcel to generate excel file

Please let me know how to do this

Upvotes: 0

Views: 2064

Answers (1)

Empty Coder
Empty Coder

Reputation: 589

This worked for me

Import-Csv -Path "C:\Scripts\Index.csv" | Export-Excel -Path "C:\Scripts\IPReports\ipaddress.xlsx" -WorkSheetname 'Index' -MoveToStart

Thanks all

Upvotes: 1

Related Questions