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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 import excel file and plot a graph

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
nilo Posted - 04/04/2012 : 10:25:25 AM
Origin Ver. and Service Release (Select Help-->About Origin): 7.5 (or 8)
Operating System: Win XP

Hi,
I've never program with origin but I'd like to automatize operations I'll do on several files.

I want to import excel file as new workbook, rename workbook with the filename, add a column to make calculation inside, plot a graph with two layers (and using my template) and add the workbook name on the graph.

I don't know how to start. I've tried several things but depending on the version (7.5 or 8) sometimes part is working, sometimes nothing...

Thanks for your help
2   L A T E S T    R E P L I E S    (Newest First)
nilo Posted - 04/10/2012 : 09:50:31 AM

Hi,

Thanks a lot for your help. I'm now working on Origin 8.6 (which look very nice).

what I did to import my file and plot it:

fname$="C:\vds-id-20-a.xls"; impExcel cell:=0 sname:=1 d:=NN;
plotxy ((5,4),(5,9),(5,14),(5,19),(5,24),(5,29)) plot :=202 ogl:=[<new template:="C:\IdVd1.otp" name:="W">]

How can I do this sequence for all the files "vds-ids*.xls" ?
How can I limitate the number of empty columns to 1 for each sheet ? (I tried emptycols:=1 unsuccessfully…)
Can I rename the graph with the filename (or bookname) ?
How can I apply a theme to the graph ? I tried themeApply2g but It's not working with my theme or maybe I used a wrong sentence(C:\IdVd.oth). Otherwise I'll use themeApply2g -d on the folder.

I know it's a lot of questions but It's really new for me. Thank you for your time.
Laurie Posted - 04/04/2012 : 11:54:23 AM
The following will work in version 8 or later:

To import Excel, please use the impExcel x-function. This function has import options that you can set to rename the workbook with the filename.

To add a column: wks.addcol()

To plot data, use the plotxy x-function.

To add the workbook name to the graph, you could edit the legend. To do this, select Graph:Update Legend. Set 'Auto Legend Translation Mode' to Custom and then enter a custom format of @W. This change is saved when you save the graph as a template. You can also create another text label with this @W. Let me know if you need an example. Text labels are saved as part of graph templates.

OriginLab Technical Support

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000