General Discussions

Discuss any topics that are not product-specific here.

CREATING EXCEL WITH PYTHON

mkbayar
6 - Meteoroid

Output of excel python code in Workflow. I want to add python code to Workflow. I want it to continue working by getting the output from this code. You can find the code in python tool.

2 REPLIES 2
caltang
17 - Castor
17 - Castor

You can use the Python Tool under the Developer tab in your workflow. It'll launch a Jupyter notebook for you to key in your code and execute it.

 

Be mindful of your packages, you may need to pip install most of them to be safe. Re: https://www.geeksforgeeks.org/how-to-install-pip-on-windows/ 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Sangini
7 - Meteor

Hello,

So, let's understand it in very simple words. Making an Excel file with Python is like making a digital notebook. Let's imagine you have a blank notebook, and you want to write some stuff in it using Python. To do this, we use a special tool called -  openpyxl.

First, tell your computer to get this tool by typing 'pip install openpyxl in a special window. After that, in your Python code, you make a new notebook ('workbook') and open a page in it ('sheet'). Then, you write things on the page like you would in a notebook.

import openpyxl

# Make a new notebook (workbook)
workbook = openpyxl.Workbook()

# Open a page (sheet) in the notebook
sheet = workbook.active

# Write something on the page
sheet['A1'] = 'Hello'
sheet['B1'] = 'Python'

# Save your notebook with a special name
workbook.save('my_excel_file.xlsx')

As you can see, we wrote 'Hello' in cell A1 and 'Python' in B1.
Lastly, we saved our work with the name 'my_excel_file.xlsx'.
You can change the words, where you put them, and the file name to fit what you want in your digital notebook. That's basically how you create an Excel file with Python.

I hope this will help you. 
https://community.alteryx.com/t5/forums/replypage/board-id/general-discussions/message-id/9759python

Regards
@Sangini 

Labels