The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Append worksheets varying in numbers, wAppend
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dekos

8 Posts

Posted - 07/22/2021 :  09:18:09 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2021b
Operating System: Win10

Hello.
When importing my files I come to a step where I have to combine every sheet in the specific workbook. Problem is, I don't find a way to say "combine all", i.d. the whole workbook.
Is there a way to do it in command line? Right now I use this command and always change the number of sheets (eg. 5 sheets):
wAppend irng:=[<active>](1,2,3,4,5) method:=column ow:=[<new>]<new>;

Thanks!

snowli

USA
1386 Posts

Posted - 07/22/2021 :  11:20:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,
Thanks for reporting this. I jiraed this in browse/ORG-24015
for our developer to check.

We support dynamic ending with 0, e.g. 1:0 means from 1st to last in column, rows, and worksheet in some places but not in wAppend.


Could you let me know what import tool did u use to import?
Suppose you are importing ascii files, if u choose Data: Import from Files: Multiple ASCII...
There is Import Options -> Multi-File (except 1st file) Import Mode. There are Start New Columns and Start New Rows options to append all data column wise or row wise in same sheet.

Thanks, Snow
Go to Top of Page

minimax

348 Posts

Posted - 07/22/2021 :  11:24:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi dekos,

What is your whole script process?

i.e. do you use script to import files?
after worksheet is appended, what script is run after it?

Do you plan to create a brand-new output of wappend every time after a new import?
Or you would expect to auto update the existing output when import data(number of sheets) changes?




Max
OriginLab Technical Support
Go to Top of Page

minimax

348 Posts

Posted - 07/23/2021 :  02:38:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You may try if following script works.


# ...;
# import scripts and number of sheet changes;
# ...;

string srcbook$="Book1";  //Input book name which contains import data sheets
string desbook$="Book2";  //Output book name of wAppend 

//use XF op_change to update the input range to re-include all sheets

op_change ir:=[desbook$]1!1 tr:=abc op:=get;
abc.xfGetN.irng$=[srcbook$](1:0)!;    //(1:0)! refers to all sheets in the book
op_change ir:=[desbook$]1!1 tr:=abc op:=run;


You can also use (1:0)! in wappend script like
//It is a good habit to add exclamation mark ! at the end to explicitly indicate it is a sheet range
wappend -r 2 irng:=[srcbook$](1:0)! method:=column ow:=[<new>]<new>;


But note that (1:0)! is not dynamic, it is parsed as the specific fixed number of sheets at the moment when it is executed.
Therefore, you will need to use XF op_change to re-update it if number of sheets change after wAppend is run.


Max
OriginLab Technical Support
Go to Top of Page

dekos

8 Posts

Posted - 07/26/2021 :  10:50:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

Could you let me know what import tool did u use to import?
Suppose you are importing ascii files, if u choose Data: Import from Files: Multiple ASCII...
There is Import Options -> Multi-File (except 1st file) Import Mode. There are Start New Columns and Start New Rows options to append all data column wise or row wise in same sheet.



Import Wizard --> Multiple ASCII.
Import 3 columns from each file to one sheet and unstack 1 and 2 into groups defined by 3 (this is why i have to use "start new sheets"). In the end, bring all columns together in one sheet.
Go to Top of Page

dekos

8 Posts

Posted - 07/26/2021 :  11:23:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by minimax

You can also use (1:0)! in wappend script like
//It is a good habit to add exclamation mark ! at the end to explicitly indicate it is a sheet range
wappend -r 2 irng:=[srcbook$](1:0)! method:=column ow:=[<new>]<new>;


But note that (1:0)! is not dynamic, it is parsed as the specific fixed number of sheets at the moment when it is executed.
Therefore, you will need to use XF op_change to re-update it if number of sheets change after wAppend is run.




Hi, thanks for your help. I can actually use it, but not with the "active" reference (what I don't understand).
I rename the workbook, use wAppend (creating a new workbook), and delete the renamed workbook.

Not working:
wAppend irng:=[<active>](1:0)! method:=column ow:=[<new>]<new>;

Working:
win -r %H XYtobedeleted%H;
wAppend irng:=[XYtobedeleted](1:0)! method:=column ow:=[<new>]<new>;
win -c XYtobedeleted;

Not a beautiful piece of code, but it does the job XD
Go to Top of Page

snowli

USA
1386 Posts

Posted - 07/26/2021 :  12:51:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If the workbook is active window, you don't need to have book part in input.

E.g. If only specifying the sheet part, it will use active book.
wAppend irng:=(1:0)! method:=column ow:=[<new>]<new>;

Thanks, Snow
Go to Top of Page

minimax

348 Posts

Posted - 07/26/2021 :  9:28:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi dekos,

It is not easy to support [<active>](1:0)!

We suggest you either skip it as Snow mentioned, or pre-defined the book name like [myBook$](1:0)!

You do not need to activate that book if you have specified the name in the range string.
Go to Top of Page

snowli

USA
1386 Posts

Posted - 11/24/2021 :  09:39:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Dekos,

Just FYI that in Origin 2022 we just released, we support
wAppend irng:=[book1] method:=column ow:=[<new>]<new> -r 2;

If only specifying the book name, it will use all sheets in book1.

Some limitations still:
1. [<active>] not supported
2. No recalculation support. E.g. if u add a new sheet, it will not update the output to include new sheet.


Thanks, Snow
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000