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 for Programming
 LabTalk Forum
 Importing specific sheets of 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

achu6393

India
38 Posts

Posted - 07/03/2017 :  12:22:54 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear all,

I am using impExcel X-Function for importing excel file through script. Is there an option that I can import only the 1st sheet of each excel file (5 excel sheets) that I am importing through LabTalk?

Origin Ver. and Service Release (Select Help-->About Origin): 9.3
Operating System: win 7

such coding! much wow!

yuki_wu

896 Posts

Posted - 07/03/2017 :  10:25:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I am afraid that there is no way to import a specified sheet by LabTalk, even I find that there is an option in impExcel X-Function GUI. It is weird that Origin has not provided an open interface for this option. I will bring your case to our weekly share meeting and see what we can do to improve it.

For now, you might need to import all sheets and then delete the undesired sheets.

Regards,
Yuki
OriginLab
Go to Top of Page

achu6393

India
38 Posts

Posted - 07/06/2017 :  07:09:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hello yuki,

That'd be great! Thank you.

such coding! much wow!
Go to Top of Page

greg

USA
1379 Posts

Posted - 07/30/2017 :  11:50:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Is this what you want:

dlgfile fname:=filenames group:="*.xls" multi:=1;
numfiles = filenames.getnumtokens();
loop(ii,1,numfiles)
{
fname$ = filenames.gettoken(ii,CRLF)$;
impExcel sheet:=1; // First sheet;
if(ii < numfiles) newsheet;
}

Edited by - greg on 08/14/2017 12:09:28 PM
Go to Top of Page

yuki_wu

896 Posts

Posted - 11/14/2017 :  05:26:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi achu6393 and who noticed this post,

We have improved the X-Function impExcel and impMSExcel. Now we are allowed to import the specified Excel sheets into Origin. Please refer to these examples below:
https://www.originlab.com/doc/X-Function/ref/impExcel#Examples
https://www.originlab.com/doc/X-Function/ref/impMSExcel#Example_3

Origin 2018 released last week. You can upgrade or download a demo to see how it works:
http://www.originlab.com/index.aspx?s=12&lm=62

Of course, we have many other improvements and new features in Origin 2018. You can visit
Originlab.com/2018 for more info.

Thanks,
Yuki
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