In this Python tutorial, I will be covering how to automate Excel spreadsheets using win32com (pywin32) library in Python.
Things I will be covering in this tutorial:
1. Create a new Excel spreadsheet
2. Write/Read data from an Excel spreadsheet
3. Save the Excel file
Buy Me a Coffee? Your support is much appreciated!
PayPal Me: https://www.paypal.me/jiejenn/5
To install win32com library: pip install pywin32
# why win32com?
As a Windows user myself, the win32com library provides me with the flexibility to communicate multiple applications and integrate them with ease. Especially, I can control the applications while the applications are open. The other advantage win32com has over other Excel Python libraries is that, using win32com to link to an COM object application, I will have access to the entire object models vs other Excel Python libraries will only have a limited features available.
## win32com (pywin32)
A Python extension for Microsoft Windows provides access to the Win32 API. Using Win32 API, we will be able to create and use COM objects to automate applications such as Microsoft Excel, Outlook, Word, Access, PowerPoint, or event Photoshop. On top that, we will be able to automate a wide range of features on Windows.
Support my channel so I can continue making free contents
By shopping on Amazon → https://amzn.to/2JkGeMD
More tutorial videos on my website → https://LearnDataAnalysis.org
Business Inquiring: [email protected]
You should add chapters to your video. Makes it more useful. Thanks
Great video! How do I dynamically copy the range from A1 to E5 without specifying E5? like in VBA you could start from A1 and do xldown, xlright…
Could you pls tell how do you add custom calculation on pivot table via win32com? i mean the usage of win32com.client.constants.xlPercentOfParentRow?
Will this work with Excel 2007, do you know? Thanks.
Thank you. It has been of great help.
can i also put formula and return the value instead of none?
At work I have all these different excel spreadsheets I need scan through for information. I want to create a prompt that ask for the name of the user and scans through these excel spreadsheets n then shows me predetermined useful information I would need.. is this possible with python?
thanks Jie, this simple to understand that it is possible modify data in excel with Pyton , no need VBA
Thanks for this video! Could you advise which would be the best way to copy data between different books? My main goal would be to create a database by getting data from various excel books in just one. Thanks in advance!
How to bring it to foreground instead just opening in the background… Please Help….
How can I open another worksheet.
Thank you for preparing the awesome video. This video is very easy to understand. I have the motivation to continue learning python.
in openpyxl, you could have a python list, and each list object would go in the next column…. so you could quickly input data by row….. any idea how this can be done in win32com?
Great tutorial! I have been using openpyxl… But I think this would be a better option
Could this work with LibreOffice Calc as well? Thank you for your reply…
Thank you thank you. Now I know how to use VBA Object modele in my Python code. I search this many years. I didnt think just to take from Microsoft doc. So simple.
Awesome video, keep up the amazing work! 🙂