-
-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Support both Object
and Variant
return types in UDFs.
#2312
base: main
Are you sure you want to change the base?
Conversation
46ce427
to
fd1abdc
Compare
I added instructions on how to run the UDF tests: https://github.com/xlwings/xlwings/blob/main/DEVELOPER_GUIDE.md#tests If no unit test, a code sample of what this PR allows you to do would be great. |
And ignore the pipeline failure, that's now fixed on main. |
OK, so I ran into a few problems here... Please bear with me.
The only relevant thing I see here is:
I created a venv for xlwings development. If I don't install anything, and just follow these instructions, I get Then I noticed that xlwings is using the wrong Python. To try to fix that, I ran To try to install dependencies, I ran It looks like I'm going to have to build a separate VM for xlwings development, and install a lot of dependencies. I would really like to help you here, but without better instructions on how to get started, that's almost impossible.
EDIT: I provided a bogus example here. New example is at #2312 (comment) below. Use cases:
|
Thanks for the sample and fair point about nose! I removed that dependency now on the |
How to get by without Rust is explained here: https://github.com/xlwings/xlwings/blob/main/DEVELOPER_GUIDE.md#python-package |
I'm on a fresh Windows 10 installation, I followed the steps at https://github.com/xlwings/xlwings/blob/main/DEVELOPER_GUIDE.md#tests exactly (even with Rust), and I had to do
Also, the correct place for the But the good news is that I can run the UDF tests now. |
|
As I'm writing the unit tests, I realized that I gave a bogus example above of what I'm trying to do! So let me clarify the use case: 1. Returning arbitrary objects from VBA to Python already works
2. Returning objects like a dict from Python to VBA already works
3. Returning arbitrary VBA objects from Python to VBA (not from VBA to Python)This is what is currently not possible, and what my PR will solve.
Similarly, we might want to pass something returned in case 1 above (e.g. the collection object or some other object) back to VBA at some point. Without my PR, we will get an error like this: With my PR and the example above, it works, and VBA gets a bona fide |
fd1abdc
to
028b1d1
Compare
Rebased and added tests :) |
Awesome, thanks! |
028b1d1
to
f09e8cd
Compare
Rebased again. Please consider. |
thanks, I'll try to get to it next week |
I tested this manually in our system, and it seems to work.
Sorry, no unit tests, because I could not figure out how to get tests running in this project.