Author |
Topic  |
|
daliss
France
Posts |
Posted - 03/22/2006 : 07:04:09 AM
|
Origin Version (Select Help-->About Origin): Pro7.5 Operating System:XP
Hello All
I want to export multiple worksheets to respective ASCII files. I can use "save -w wksName fileName" to export one worksheet. But I don't know how to get those worksheets names and save them to ASCII files? For example, I open a project including three worksheets which names are B1,D2 and E3£¬respectively. My purpose is converting B1,D2,E3 worksheets to B1.txt,D2.txt and E3.txt.
Thanks for any suggestions.
Sincerely
William Peng |
|
Mike Buess
USA
3037 Posts |
Posted - 03/22/2006 : 08:31:07 AM
|
Hi William,
This will export all worksheets in the project to the same directory...
fdlog.openpath(B); // choose directory doc -e W {save -w %H %B%H.txt};
To export only those worksheets in the active project folder replace the -e switch with -ef.
Mike Buess Origin WebRing Member |
 |
|
daliss
France
Posts |
Posted - 03/22/2006 : 09:38:19 AM
|
Thans very much. It works great. |
 |
|
lsurazyn
Finland
1 Posts |
Posted - 04/27/2016 : 06:33:17 AM
|
Hello,
I would like to refresh this topic as I'm looking for same solution.
My Origin version is : OriginPro 2015(64-bit) with Windows 7 as an operating system
I tried your code Mike, it is exporting only active worksheet. Is this possible to export: long name, units and commends as well?
Thanks in advance, Lucas.
|
 |
|
SeanMao
China
288 Posts |
Posted - 04/27/2016 : 10:30:03 PM
|
Hi,
Pls try the following code which will export all worksheets in all workbooks with name as "WORKBOOK NAME_ WORKSHEET NAME".
fdlog.openpath(B); // choose directory
doc -e W{
doc -e LW
{
string temp$ = wks.name$; // Get worksheet name
expASC type:=text path:=%B%H_%(temp$) shortname:=1;
};
}
Regards!
Sean
OriginLab Tech. |
 |
|
YC.Lai
Taiwan
3 Posts |
Posted - 05/04/2016 : 01:02:17 AM
|
Hello All
Is it possible only use long name as the exported name?
Regards,
YC.Lai |
 |
|
SeanMao
China
288 Posts |
Posted - 05/04/2016 : 02:11:47 AM
|
If you want to use worksheet long name, simply replace this line:
string temp$ = wks.name$;
with
string temp$ = wks.longname$;
Regards!
Sean
quote: Originally posted by YC.Lai
Hello All
Is it possible only use long name as the exported name?
Regards,
YC.Lai
|
 |
|
M.Steidl
2 Posts |
Posted - 02/27/2017 : 12:16:00 PM
|
Origin Version 9.1.0G (64-bit) Sr1 Operating System:Windows7
Hello all,
I would like to export all worksheets in all workbooks with name as "WORKBOOK LONGNAME_ WORKSHEET LONGNAME"
How do I have to adjust the code of SeanMao posted 04/27/2016 or the code of Mike Buess posted 03/22/2006 ? I guess one has to replace %H by something to have the longname of the workbook instead of its shortname. But by what?
Thank you very much for your help!
|
 |
|
yuki_wu
896 Posts |
Posted - 02/28/2017 : 01:43:53 AM
|
Hi,
You are right. You can just replace %H as follows:
string temp1$ = page.longname$;
string temp2$ = wks.longname$;
expASC path:=%B%(temp1$)_%(temp2$);
Hope it helps.
Regards, Yuki OriginLab
|
Edited by - yuki_wu on 02/28/2017 05:20:11 AM |
 |
|
M.Steidl
2 Posts |
Posted - 02/28/2017 : 05:07:02 AM
|
Hello,
thank you, yuki, for your help. You made a small spelling error in "page.longname$": you had an "a" instead of "g". I corrected it and now it works fine. The final command is the following:
fdlog.openpath(B); // choose directory
doc -e W{ doc -e LW { string temp1$ = page.longname$; // Get workbook name string temp2$ = wks.longname$; // Get worksheet longname (replace by wks.name for shortname) expASC path:=%B%(temp1$)_%(temp2$); }; }
I'm surprised though that "page" refers to the workbook. How can I understand that and where could I read more about that topic?
best regards, Matthias |
 |
|
yuki_wu
896 Posts |
|
Whydoge
2 Posts |
Posted - 08/19/2021 : 10:37:37 AM
|
Hello, id like to ask an additional question: Origin 8.6
I want to export from multiple Books (which are in one folder inside an origin project). I can do that using the commands you have kindly supplied herein already (fdlog.openpath(B); doc -ef W{save -w %H %B%H.txt};) However, I have 3 sheets in each book - I need to export only the second sheet from all the books. Ideally, only the colums 1,2, 4, 6, and 8. If that is possible in any way?
Much thank you for your help. Whydoge |
Edited by - Whydoge on 08/19/2021 1:07:47 PM |
 |
|
|
Topic  |
|