In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Dynamic Tab Renaming with Python

Ornelasya
7 - Meteor

Hello!

 

May I get some help with a bit of Python code? Essentially, I would like to be able to provide a list that includes a file path, an old sheet name, and the name I would like that old sheet name to be changed to. These are for excel workbooks with multiple sheets and the contents of the sheets need to remain unchanged after the tabs are renamed. I've attached a sample scenario/WF below for clarity.

 

 

Ornelasya_0-1656695141155.png

 

Thank you for your help!

11 REPLIES 11
Kingazawora
8 - Asteroid

Hello

 

I am getting the following error:

 

NameError                                 Traceback (most recent call last)
Cell In[3], line 2
      1 for i, (file, old_sheet, filename, new_sheet) in df.iterrows():
----> 2     wb = XL.load_workbook(file)
      3     try:
      4         ss = wb[old_sheet]

NameError: name 'XL' is not defined - any idea why that is? 
apathetichell
20 - Arcturus

@Kingazawora --- python is case sensitive. The original code imported the excel python package as xl.... if you are doing that --- you can use xl.load_workbook.

 

 

Labels
Top Solution Authors