Sat Nuna
asked on
open csv file as excel by using command prompt
I have to open csv file after creating from Powerbuilder.
Upon creating csv file , I have to open csv file as excel file automatically.
So I think it is better to use command prompt.
How could I open csv file as excel by using command prompt?
Upon creating csv file , I have to open csv file as excel file automatically.
So I think it is better to use command prompt.
How could I open csv file as excel by using command prompt?
if i have a file called examples.csv in a folder called downloads on my E: drive - so the path to the file is e:\downloads\examples.csv. I simply need to call excel.exe and provide the filename path at the end
so, assuming that the PATH variable does not already include the path to the Excel exe file, I would need to put in "c:\program files (x86)\microsoft office\office15\excel.exe" to launch Excel (2013)
to launch excel and open the CSV file, I would simply type this command (you need the quotations because of the spaces in the folder path)
"c:\program files (x86)\Microsoft Office\Office15\Excel.exe" e:\downloads\examples.csv
so, assuming that the PATH variable does not already include the path to the Excel exe file, I would need to put in "c:\program files (x86)\microsoft office\office15\excel.exe"
to launch excel and open the CSV file, I would simply type this command (you need the quotations because of the spaces in the folder path)
"c:\program files (x86)\Microsoft Office\Office15\Excel.exe"
ASKER
The path written for location at installed excel seems it depends on where you installed office and what version installed.
So I think if I use this command, I should have located the installed path before.
Can't I use other way or can I locate the path simply by using command prompt or powerbuilder?
So I think if I use this command, I should have located the installed path before.
Can't I use other way or can I locate the path simply by using command prompt or powerbuilder?
you could use additional commands to find the excel.exe file, and then build that into the path - however that is a bit more complex.
much easier to accomplish in VBS
much easier to accomplish in VBS
strComputer="."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = TRUE
Set objWorkbook = objExcel.Workbooks.Open("e:\downloads\examples.csv")
ASKER
Than you for your help.
It worked!
It worked!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Than you for your solution.
It rather simple than vbs and worlk any pc.
It rather simple than vbs and worlk any pc.
ASKER
Yes your solution is best . But I don't know how to change accepted comment.
ASKER
thanks
pls try something like
Open in new window
Adjust the path of Excel accordinglyRegards