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
 Forum for Python
 Creating new sheets in existing books

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
MbelairB Posted - 07/20/2023 : 1:38:59 PM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2021 9.8.0.200
Operating System: Win 10
internal Python: 3.8.3
originpro 1.1.7

Hi,
so I am "translating" some of my labtalk scripts to python (easier to develop for me). While I was able to get most things working out of the box, I am struggeling with something stupendiously simple.

I have trouble making a new sheet within an existing workbook. No matter what I do, I only managed to make a new sheet as part of a new book.
Unfortunately, I don't find any useful hints in the python documentation beside to mention a lname (which I tried, see MWE). So maybe someone of you has an idea? I also tried wkb.new_sheet, but a workbook apparently doesn't have any new_sheet functions.

My next attempt would be to move the sheet to the other book (although I have no clue so far on how to do it)
Best regards

MWE:
import originpro as op

# read the current workbook ## this is from my original script
wkb = op.find_book()
# calculations ## from original script not needed so removed
# so this is my attempt in getting the sheet into the existing (and currently being used) book, but it does not work.
output = op.new_sheet('w', lname=str(wkb))
4   L A T E S T    R E P L I E S    (Newest First)
MbelairB Posted - 07/25/2023 : 12:15:28 PM
quote:
Originally posted by minimax

The auto-complete hint should work for any editor in general I suppose.



Yes, that was what I was expecting as well. Don't know why it wasn't working. I completely resettet my VSC and the plugins and now it seems to be working just fine.

I am using 1.80.1 as well, but with some various plugins (custom highlighting, extended code completetition etc), I guess one of it was blocking the python module viewer for modules that came after their installation.

However, it's working now
So, thank you very much again
minimax Posted - 07/24/2023 : 10:05:09 PM
The auto-complete hint should work for any editor in general I suppose.

I just tried Visual Studio Code (v1.80.1), and it seems also showing.

But I am not clear what configuration should be modified.




MbelairB Posted - 07/24/2023 : 07:18:43 AM
Thx minimax.

This was exactly what I was looking for.
Unfortunately, I can't use the build in code editor, I only have limited access to the machine that runs origin so I have to develop the script externally.
And since I'm very used to VSC, I also don't wanted to adapt to a new tool. I'll however reconfigure my VSC, it is not showing me this method in my tool tips.

But thank you very much.
Cya
minimax Posted - 07/20/2023 : 9:58:43 PM
Hi MbelairB,

You can call method add_sheet, like
wkb.add_sheet()


PS, it is supposed there is auto-complete hint on typing python scripts, which should be helpful to see what method is available.


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