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
 Forum for Python
 Duplicate specific data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Fabi K

Germany
4 Posts

Posted - 04/29/2022 :  04:32:30 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone,

I want to duplicate an existig sheet with data to a new sheet with another template. I dont want to duplicate all data but only specific columns selected by theier longnames. What is the best way to do this?
I tried using pandas but than the data was only in one column.

Thanks in advance
Fabi

YimingChen

1621 Posts

Posted - 05/02/2022 :  11:57:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can use wks.to_list() to pass data from specified column to Python list and wks.from_list() to pass data back to worksheet column. See the reference page:
https://www.originlab.com/python/doc/originpro/classoriginpro_1_1worksheet_1_1_w_sheet.html#a1373d42387a3ac2396a0e535fee74078

James
Go to Top of Page

Fabi K

Germany
4 Posts

Posted - 05/09/2022 :  06:04:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi James,

thanks for your help. I’ve solved it a little differently. The problem was that the csv data is very large and wks.to_list() did not work. So I used wb.duplicate() (def originpro.base.BasePage.duplicate) and deleted the unnecessary columns with wb.del_col(). After that, the data was small enough to use wb.to_df() and put it in a template where I could process the data further.
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