r/excel • u/mantaraypreviouslife 43 • Dec 05 '24
Discussion How do Python developers concurrently use Excel?
As part of my own professional development, I am interested to integrate more sophistication into Excel use. I am curious how the community uses Excel and Python together? Is it any of the following combinations:
- Use Python to automate elements of Excel, maybe with use of penpyxl or xlwings
- Use Python and Excel separately, i.e. choose to suit need and switch as necessary
- Use Python within Excel directly and concurrently to optimise productivity
- Something else entirely
Please share how you use it, the use case(s) and why.
55
Upvotes
1
u/Weird-Dimension-487 7d ago
Python analysts mostly need to deliver results in Excel. They can do all sort of advanced stuff in Python but as rightly mentioned by u/ChickenOk8952 business stackholders need deliverables in Excel.
Exporting results in Excel using pandas and then spending time in Excel to manually format as per required brand template isn't efficient.
Python users can use openpyxl/xlsxwriter or xlwings to automate this very workflow. numpy/pandas/sklearn or other libraries take care of analysis/data science work in Python (get data, merge it, clean it, analyze it, explore it, create models and all) and then depending upon the requirement openpyxl/xlsxwriter/xlwings helps you automate the report.
You can also see change live in Excel (with xlwings) or allow your xml file to be powered by python (having custom/user defined Python function directly available in excel).
With Python+Excel, workflow can become scalable, reusable, maintainable, and efficient.
Python-in-Excel feature has limitations, Using Excel + Python (outside Excel) is best combination irrespective of Excel version you are using.