问题
From the Microsoft help I can see that it's possible to define your own delimiter
in the part Workbooks.Open
. I'm having issues to have it accept semicolons as a delimiter.
This is part of a bigger script where my tried changes failed:
$tempcsv = $excel.Workbooks.Open("$input",6,";")
$tempcsv = $excel.Workbooks.Open("$input",6,4)
Error message:
Exception calling "Open" with "3" argument(s): "Open method of Workbooks class failed"
Thank you for your tips guys.
回答1:
The arguments are positional so you can't just put the format argument next to the filename. You'll need to do something like the below:
$excel.workbooks.open("$input",$null,$null,'4')
However, as @DavidBrabant says, you'd probably be better off using Import-Csv
来源:https://stackoverflow.com/questions/25179700/powershell-workbooks-open-with-delimiter-semicolon