|
1 | 1 | # ExcelPython v2
|
2 | 2 |
|
3 |
| -### Get started |
| 3 | +Write Excel user-defined functions in Python! |
4 | 4 |
|
5 |
| -* Download the [latest release](https://github.com/ericremoreynolds/excelpython/releases) |
6 |
| -* Unzip it into the folder containing your workbook (this will create the `xlpython` folder) |
7 |
| -* Import the module `xlpython\xlpython.bas` into your workbook |
8 |
| - |
9 |
| -and you're set! No registration or typelibs. All that is needed is Python with PyWin32 installed. |
10 |
| - |
11 |
| -```vb.net |
12 |
| -Sub test1() |
13 |
| - MsgBox Py.Str(Py.Eval("1+2")) |
14 |
| -End Sub |
15 |
| - |
16 |
| -Sub test2() |
17 |
| - Set vars = Py.Dict() |
18 |
| - Py.Exec "from datetime import date", vars |
19 |
| - MsgBox Py.Str(Py.Eval("date.today()", vars)) |
20 |
| -End Sub |
21 |
| - |
22 |
| -Sub test3() |
23 |
| - ' Assumes there's a file called MyScript.py in the same folder as the workbook |
24 |
| - ' with a function called MyFunction taking 3 arguments |
25 |
| - Set m = Py.Module("MyScript") |
26 |
| - MsgBox Py.Str(Py.Call(m, "MyFunction", Py.Tuple(1, 2, 3))) |
27 |
| -End Sub |
| 5 | +```python |
| 6 | +from xlpython import * |
| 7 | + |
| 8 | +@xlfunc |
| 9 | +@xlarg("x", "nparray", 2) |
| 10 | +@xlarg("y", "nparray", 2) |
| 11 | +def matrixmult(x, y): |
| 12 | + return x.dot(y) |
28 | 13 | ```
|
29 | 14 |
|
30 |
| -Note that the latest release zip also contains an Excel add-in `xlpython.xlam`. We're still in the process of developing that, not to mention writing the documentation - but feel welcome to take a look, and see what it does! Sneak preview: automatic generation of VBA wrappers for Python functions. |
31 |
| - |
| 15 | + |
| 16 | + |
32 | 17 | ### About ExcelPython
|
33 | 18 |
|
34 |
| -ExcelPython is a lightweight, easily distributable library for interfacing Excel and Python. It enables easy access to Python scripts from Excel VBA, allowing you to substitute VBA with Python for complex automation tasks which would be facilitated by Python's extensive standard library. |
| 19 | +ExcelPython is a lightweight, easily distributable library for interfacing Excel and Python. It enables easy access to Python scripts from Excel VBA, allowing you to substitute VBA with Python for complex automation tasks which would be facilitated by Python's extensive standard library while sparing you the complexities of Python COM programming. |
| 20 | + |
| 21 | +### Getting started |
| 22 | + |
| 23 | +* Download the [latest release](https://github.com/ericremoreynolds/excelpython/releases) |
| 24 | +* Check out the [tutorials](docs/) to help you get going |
35 | 25 |
|
36 |
| -v2 is a major rewrite of the previous ExcelPython, moving over to a new approach which is more robust and configurable - and importantly should eliminate all those irritating DLL not found problems! The technical details: Python now runs out-of-process and communication happens over COM. |
| 26 | +The only prerequisites are Excel and Python with PyWin32 installed. |
37 | 27 |
|
38 | 28 | ### Help me!
|
39 | 29 |
|
40 |
| -Check out the [docs](docs/) folder for tutorials to help you get started and links to other resources. |
| 30 | +Check out the [docs](docs/) folder for tutorials to help you get started and links to other resources. Failing that, try the [issues section](https://github.com/ericremoreynolds/excelpython/issues?q=) or the [discussion forum on SourceForge](https://sourceforge.net/p/excelpython/discussion/general/). |
41 | 31 |
|
42 |
| -If you don't find your answer, need more help, find a bug, think of a useful new feature, or just want to give some feedback by letting me and everyone else know what you're doing with ExcelPython, please create an issue ticket! |
| 32 | +If you still don't find your answer, need more help, find a bug, think of a useful new feature, or just want to give some feedback by letting us know what you're doing with ExcelPython, please go ahead and create an [issue ticket](https://github.com/ericremoreynolds/excelpython/issues/new)! |
0 commit comments