Город МОСКОВСКИЙ
00:03:23

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

Аватар
Умные помощники для всех
Просмотры:
23
Дата загрузки:
02.12.2023 04:28
Длительность:
00:03:23
Категория:
Технологии и интернет

Описание

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

Рекомендуемые видео