Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
heckljo
Posted - 11/07/2017 : 12:25:22 PM Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0 Operating System: Win 7
Hello Guys,
at first please note I am totally new to programming. Im stuck at a pretty basic function as I am trying to import csv files from our spectrometer. Frist baby steps are:
I want origin to import the file and put it in a new workbook. I therefore use the tree options... to define this.
Hence, Origin responds with "command error" No workbooks are open yet when Im entering these lines in the command window. adding "newbook;" at the start of my lines seems so solve the problem somehow. It leaves me with alot of questions marks why options... is irgnored/interpretated incorrectly
Thanks already for your support,
Philipp
4 L A T E S T R E P L I E S (Newest First)
cpyang
Posted - 11/09/2017 : 11:05:12 PM Hideo's example of adding quotes to a string variable is incorrect. When using string variable there is no issues with spaces in the file path.
The key is that the impscv function import a file to an existing book, so you must first have a workbook before you can use this x-function, like you have found out.
It is true that this x-function should report proper error when the input book does not exist.
CP
heckljo
Posted - 11/08/2017 : 11:06:36 AM A good morning to you Hideo,
thank you so much for your fast resposne, i appreciate it.
I thought we solved it as no command error message was given. Hence, i found out that more likely this happened due to the usage of origin on my laptop, which hast V 9.3.226 on it. Here, no command error was recieved neither using double quotes nor without them.
May this be a bug or a general issue of V 9.0.0?
Regards,
Philipp
Hideo Fujii
Posted - 11/07/2017 : 4:09:18 PM Hi Philipp,
Becsause your path/file name contains spaces, double-quoting the file name as below in impcsv command may work:
impcsv fname:="fn$" Options.FirstMode:=3;
Could you please try?
--Hideo Fujii OriginLab
greg
Posted - 11/07/2017 : 4:08:37 PM All X-Function parameters have default values. When you do not specify a parameter value, Origin uses the default value. In this case, you did not specify the orng value so the function assumes the active window is a Workbook and will fail if it is not.