Opening Excel Reports in a New Window

by Jan 21, 2011

When opening CSV files with Excel from PowerShell, you may receive exceptions if the particular file was opened by Excel already:

Invoke-Item c:\files\report.csv

You can work around this by telling Excel to open a new window for the CSV file. Here is how:

Start-Process Excel -ArgumentList c:\files\report.csv

This will load c:\files\report.csv in a new Excel window, so you do not get an exception if the file was already open in another instance of Excel. Instead, you will get a friendly dialog asking if you want to open the new file as write-protected copy.

Twitter This Tip!
ReTweet this Tip!