I have a VBA script in Microsoft Access. The VBA script is part of a large project with multiple people, and so it is not possible to leave the VBA environment.
In a section of my script, I need to do complicated linear algebra on a table quickly. So, I move the VBA tables written as recordsets) into Python to do linear algebra, and back into VBA. The matrices in python are represented as numpy arrays.
Some of the linear algebra is proprietary and so we are compiling the proprietary scripts with pyinstaller.
The details of the process are as follows:
- The VBA script creates a csv file representing the table
input.csv. - The VBA script runs the python script through the command line
- The python script loads the csv file
input.csvas anumpymatrix, does linear algebra on it, and creates an output csv fileoutput.csv. - VBA waits until python is done, then loads
output.csv. - VBA deletes the no-longer-needed
input.csvfile andoutput.csvfile.
This process is inefficient.
Is there a way to load VBA matrices into Python (and back) without the csv clutter? Do these methods work with compiled python code through pyinstaller?
I have found the following examples on stackoverflow that are relevant. However, they do not address my problem specifically.