Is there a way to limit the number of HTTP calls the web service function does at the same time?
I have a spreadsheet that uses the web service function (WEBSERVICE()
) to look up data on an API.
It's a large sheet and it seems Excel makes many requests to that API at the same time, overloading the service.
Is there a way to tell Excel how many requests it can make at the same time when recalculating my sheet?
You would really have to use VBA for this. I cannot write the code, but the approach would be to enter the source information for each WEBSERVICE()
formula into the spreadsheet instead of the actual formula. Then have VBA cycle through the cells to calculate and use its ability to produce the result of a formula to effectively run each cell's formula one-by-one.
Better yet, of course, would be to use VBA's own ability to "consume a web service." The following Stack Overflow
question from 2009 looks very informative:
https://stackoverflow.com/questions/474936/call-web-service-in-excel
and one of the links in the various answers is till good going to a Microsoft Support article on the subject:
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/dd819156(v=office.12)?redirectedfrom=MSDN
I only checked that one of all the links given as it was the most authoritative seeming, but all of the other links may work nicely.
There is also a macro in one answer that might be useful if only to give one a guide to setting up one's own. Of course, the MS site in the link above gives example code snippets for everything it talks about. MS does a fine job in that respect.
The important thing is that you CANNOT calculate a portion of a worksheet rather than the whole thing.
If you could, you could just shut off calculation and let the macro select acceptably sized groups of cells and have them calculate, one group, then the next, and so on. That would be a simple macro to write, but alas, Excel doesn't work that way.
Since you cannot, there is only VBA left, and fortunately, it is close to infinitely controllable. And odds are, it would be faster. So, except for the learning curve, it's kind of "all good."