Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Win10
Hello,
I am running the code below to import files from 2 different folders, to their corresponding folder in my project explorer. The different datasets are imported to new worksheets.
StringArray OxAt = {"Atomic","Oxides"};
loop(i,1,OxAt.GetSize()) //For each of those strings
{
string SEMFol$ = OxAt.GetAt(i)$; //Get the string name into a new string
pe_cd path:="/_Data/%(SEMFol$)";
string strPath$ = %XSEM\Unsorted EDX\%(SEMFol$);
path$ = strPath$;
findfiles;
impasc
Options.FirstMode:=3 //Import first dataset to a new sheet
Options.Mode:=4 //Import 2nd to nth workbook to new sheets
Options.Sparklines:=2 //Sparklines if there are less than 50 columns.
Options.Headers.CountHeaderLines:=1 //Confirm there are headers in the source data sets
Options.Headers.MainHeaderLines:=0 //Specify number of headers
Options.Headers.SubHeaderLines:=1 //Specify number of subheaders
Options.Headers.LongName:=1 //Set 1st subheader as long name
Options.Names.AutoNames:=0 //Do not rename workbooks automatically
Options.Names.FNameToColComm:=0 //Use file names in column comments
Options.Names.FNameToSht:=1 //Use file names to rename worksheets
Options.Names.FNameToBk:=0 //Do not fill comments with file names
Options.Names.FPathToComm:=0 //Do not fill comments with file path
Options.FileStruct.NumSep:=1 //Decimals are after a dot (90.25). For 90,25 write 1 instead
Options.FileStruct.Delimiter:=3;
doc -ef LW
{
//(irrelevant column values information)
}
newbook;
}
As you can see, the datasets are imported to /_Data/Atomic/ and /_Data/Oxides/ folders within the project explorer.
The import goes ok right until after doc -ef LW command. If I stop it there, I have one multi-worksheet book under each folder.
As soon as I include newbook command and run the code, both workbooks are placed under Atomic folder and one new, empty workbook is created under Oxides folder.
I simply cannot understand this behaviour. Please enlighten me.