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
 Export to excel
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

millot.marius

USA
38 Posts

Posted - 11/09/2016 :  4:48:46 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2016 b9.3.1.273
Operating System:win 7 on virtual machine

Hi
Is there a better way to export a whole workbook to a multitab excel spreadsheet than exporting each worksheet to csv ?

Hideo Fujii

USA
1582 Posts

Posted - 11/10/2016 :  12:34:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi millot.marius,

Could you please try the following script?:

////////////////////////////////////////////////////
nl=page.nlayers;  //number of sheets
iw$=%H;  //Input wkbook
Menu -e 34024;  //Create an Excel wkbook
ox$=%H;  //output wkbook
for(ii=1; ii<=nl; ii++) {
  window -a %(iw$);  //Activate input wkbook
  wrcopy iw:=[%(iw$)]$(ii)! ow:=[%(ox$)]$(ii);  //Copy wksheet
}
////////////////////////////////////////////////////

which creates a new Excel workbook, data copied from the original Origin workbook,
within the Origin project. Then, you can change this Excel workbook as "External" by right-clicking
the title bar, and select Properties (or, by saving the Excel book by right-clicking the title bar,
and choose Save As).

Hope this works.

--Hideo Fujii
OriginLab
Go to Top of Page

millot.marius

USA
38 Posts

Posted - 01/04/2017 :  6:28:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi

This works great, thank you

Would it be possible to optionally copy the longname column headers as the first row in the excel file, and to rename the Excel wksheet as the corresponding Origin worksheets ?
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 01/05/2017 :  3:28:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi millot.marius、

You can add "label:=1" option of the wrcopy x-function in the For loop such as:

  wrcopy iw:=[%(iw$)]$(ii)! ow:=[%(ox$)]$(ii) label:=1;
though in a more general way, this outputs not only Long Name row, but also Units and Comments rows.
http://www.originlab.com/doc/X-Function/ref/wrcopy

I hope this is okay.

--Hideo Fujii
OriginLab
Go to Top of Page

millot.marius

USA
38 Posts

Posted - 01/05/2017 :  5:16:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks!
Go to Top of Page

ben.adam

USA
7 Posts

Posted - 01/13/2017 :  7:47:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It seems this does not work for earlier versions of Origin? I tried it for version 9 and did result in one new excel sheet and a whole number of normal origin workbooks being opened. Is there another way for earlier Origin version to achieve the same result?

Thanks

Ben Adam

Benjamin Adam
Portland State / Oregon State University
Materials Engineering
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 01/16/2017 :  3:46:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Ben Adam,

Sorry, but I don't know why the script didn't work on your machine. As far as I tested in Origin 9.0 SR2, it worked.
Please make sure that Excel has been already installed in your machine to run it.

--Hideo Fujii
OriginLab
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