How to Replace VBA with Python(Step-By-Step Tutorial)

preview_player
Показать описание
How to Automate Excel with Python

In this video, I'm going to show you how to get started using Python with Excel.

We will cover how to:
* Install Python and all the relevant libraries
* Install the IDE(code editor)
* Run a script(3 different ways and it's important to understand each)
* Read and write Excel workbooks using Python
* How to trigger Python scripts from Excel events

#ExcelPython #xlWings



Related Training

Free Excel VBA Resources

Useful VBA Shortcut Keys
========================

Debugging:
Compile the code: Alt + D + C OR Alt + D + Enter
Run the code from the current sub: F5
Step into the code line by line: F8
Add a breakpoint to pause the code: F9(or click left margin)

Windows:
View the Immediate Window: Ctrl + G
View the Watch Window: Alt + V + H
View the Properties Window: F4
Switch between Excel and the VBA Editor: Alt + F11
View the Project Explorer Window: Ctrl + R

Writing Code:
Search keyword under cursor: Ctrl + F3
Search the word last searched for: F3
Auto complete word: Ctrl + Space
Get the definition of the item under the cursor: Shift + F2
Go to the last cursor position: Ctrl + Shift + F2
Get the current region on a worksheet: Ctrl + Shift + 8(or Ctrl + *)
To move lines of code to the right(Indent): Tab
To move lines of code to the left(Outdent): Shift + Tab
Delete a Line: Ctrl + Y(note: this clears the clipboard)

Table of Contents:

00:00 - Introduction
03:23 - Running Python code
08:05 - How to use OpenPyxl to read files
14:00 - How to use Pandas for data analysis
19:58 - How to use xlWings
24:43 - Installing the xlWings Addin
27:06 - Call Python from VBA
29:00 - Call VBA from Python
30:18 - Summary
Рекомендации по теме
Комментарии
Автор

I hope you enjoy this video. Let me know in the comments if you plan to use Python with Excel.

Excelmacromastery
Автор

Hi Paul, since doing your webinar VBA course (thank you it has proved useful time and again) I wandered into Python, pandas and saw that they were powerful and useful but could not for the life of me see how I could use them in the office. So glad you are still here to help. It also looks like my role playing project is getting an upgrade!

elsheep
Автор

This video worth all the credits I can possibly give, so much information in just 30 minutes. Wow this was an amazing tutorial trust me I've done a lot

sindiso_ndlovu
Автор

You are an excellent teacher & I learned about VBA from you. Would love to see you have a full course on Python / Excel / xlwings. Would sign up immediately!

rickwize
Автор

Big thanks!
After long searches without success on the net, I arrived on your site thanks to which I finally managed to understand and implement xlwings.A great moment!!!

yvonplancade
Автор

Hi Paul. Thanks for this intro to Python with EXCEL. Nice to know the options and how they work together. Thanks for sharing :)) Thumbs up!!

wayneedmondson
Автор

Wow, I do use python and Xls separately, sometimes with Pandas. But here the combination with other libraries open infinite possibilities.
Thanks 🙏👍

jaimesastre
Автор

Very useful thanks. Been using VBA in excel for a while now, and wanted to learn another language. This bridges the gap nicely and allows me to apply what I've learnt with VBA to start playing with Python a bit more :)

zetandpeligaming
Автор

This is really a very concise and powerful mini-tutorial. Take your time and revise every detail. Thanks Paul K.

DavidRejavinski
Автор

Opened the video, jumped to an area of interest, within 5 seconds I learned something new... Thank you.

z.r.
Автор

Fantastic! Have been wanting to "jump ship" to Python - I can now steadily upgrade and use the best of both worlds! Thanks for the great and easy to follow intro

michaellean
Автор

Thanks Paul, that will help me in start xl automation through python

MrPaunty
Автор

You are a Magician!
Me reading "Hello There" after you pyxld it: "Wow!"
Thank you for the content in the description,
I have spent 13 minutes watching this video.
We're on Sunday, 6PM.
Finally I found you!

isadom
Автор

OMg this video is such much beter than the others. very clear and concise Such a good instructor. great work thank you!

dwaynefong
Автор

Thanks so much. I'm newbie . Your explanation quick but we got the point

surat-dtsr
Автор

Installation worked like a charm, thank you. Though I did have to use this method to find the XLSTART folder since I don't know my way around the VBA Editor in Excel 1-Click File > Options.
2-Click Trust Center, and then under Microsoft Office Excel Trust Center, click Trust Center Settings.
3-Click Trusted Locations, and then verify the path to the XLStart folder in the list of trusted locations.

SpManos-zeke
Автор

Unique tutorial with a great contirbution!

SaidElnaffar
Автор

Thank you - this is awesome. First step taken today to learn Python thanks to you

pravinshingadia
Автор

Great thanks for this tutorial sir Paul. This is very interesting and very informative.

freeliberalminds
Автор

Awesome video.. Love VBA and now I can even use VBA via Python.. thanks for insight.. also I didnt know xlsz was a zip.. nice discovery too...

OpenSesame