Skip to content
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

Excel Web Service Function #18

Open
aperth opened this issue Jul 12, 2022 · 10 comments
Open

Excel Web Service Function #18

aperth opened this issue Jul 12, 2022 · 10 comments

Comments

@aperth
Copy link

aperth commented Jul 12, 2022

Hello,

I am trying to use the Excel function xlfWebservice to fetch the JSON of a web API and although the function works as expected, making multiple simultaneous calls to that function in Excel is pretty slow. Do you know if there is a way to use the multithreaded recalculation capabilities explained here: https://docs.microsoft.com/en-us/office/client-developer/excel/multithreaded-recalculation-in-excel? Here's my C++ code:

AddIn xai_test(
	Function(XLL_LPOPER, "xll_test", "TEST")
	.Arguments({Arg(XLL_LPOPER, "url", "is a URL to retrieve.")})
	.FunctionHelp("Return contents of URL.")
);
LPOPER WINAPI xll_test(LPOPER url)
{
#pragma XLLEXPORT
	static OPER f;

	f = Excel(xlfWebservice, *url);

	return &f;
}
@keithalewis
Copy link
Contributor

Try https://github.com/xlladdins/xll_inet. It is not async, but it might be fast enough. Still a work-in-progress so let me know if you run into any infelicities.

@keithalewis
Copy link
Contributor

keithalewis commented Jul 13, 2022

I've updated xll_inet with an async version of \URL.VIEW called URL.VIEWA. Feedback welcome.

@aperth
Copy link
Author

aperth commented Jul 25, 2022

Hello,

Thank you for this update! I tried to build and install the add-in in Excel but I get the following error: "Failed to register: \MEM_VIEW". Do you know what's causing this issue?

@keithalewis
Copy link
Contributor

I don't know, but I'll find out and let you know.
That is just a warning. Everything else should work, just not the async \URL.VIEWA.
Try \URL.VIEW("https://google.com") and VIEW(h, 0, 100) to get the first 100 characters of the result.

@aperth
Copy link
Author

aperth commented Jul 25, 2022

Unfortunately \URL.VIEW does not work either. I have a feeling that win::mem_view is causing the issue. It is used by both \URL.VIEW and \MEM_VIEW.

@aperth
Copy link
Author

aperth commented Jul 25, 2022

FYI I cloned a previous version of the repo (commit 13e95f63a) and \URL.VIEW works fine. The speed is still an issue however.

@keithalewis
Copy link
Contributor

It was not clear to me that the old \URL.VIEWA was being registered as async, hence my latest fiddling.

@aperth
Copy link
Author

aperth commented Aug 18, 2022

Have you been able to resolve the issue of \URL.VIEWA? Currently \URL.VIEW and \URL.VIEWA do not work.

@keithalewis
Copy link
Contributor

No. It is not a priority for me.

@keithalewis
Copy link
Contributor

I have figured out how to get async working in Excel UDFs. Seeasync.cpp
Let me know if that helps you fix \URL.VIEWA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants