Python in Excel! Part 5 - Create Python cells from GitHub scripts using VBA! 🐍🤩

Veröffentlicht am: 26 August 2023
auf dem Kanal: flexyourdata
3,398
77

Someone asked me a question earlier this week about whether we could use Python with VBA.

The answer is yes, sort of.

In this video:

1. A python cell is a Python script inside the PY spreadsheet function. Excel changes the way the cell behaves when that function is present. But it's still a function call.

2. A GitHub gist is a way to quickly share code files. We can click the 'raw' button to view the contents of the file.

3. Using the XMLHTTP60 library in VBA allows us to make a request to a web page and retrieve the contents. So, we can grab the python code from the gist and save it in a VBA variable.

4. We can then concatenate the Python code from the gist with the PY function and insert it into a cell.

5. The second parameter of the PY function tells the cell whether to display as a Python object (using 1 as the 2nd argument) or an Excel value (using 0 as the 2nd argument).

This is a very basic example but I hope it offers food for thought, particularly for those concerned about version control of the Python in an Excel file.

What do you think about this?

Let me know in the comments below. 💬

---

If you like this, please like, share and subscribe.

#data #analytics #excel #python #dataanalytics


Auf dieser Seite können Sie das Online-Video Python in Excel! Part 5 - Create Python cells from GitHub scripts using VBA! 🐍🤩 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer flexyourdata 26 August 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,398 Mal angesehen und es wurde von 77 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!