0

I've seen that is possible to use a web worker for doing heavy stuff and not blocking the UI thread. But from what I've tested there is no possiblity to call Excel.run() from within the worker.

The thing is: How can I run thousands of Excel.run() without getting Wait for previous operation to complete exception ?

I've tried many things, like doing in batches of 10 and waiting for every batch to finish, but still get Wait for previous operation to complete exception error sometimes.

There is also a need that inside each Excel.run() to call context.sync().

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Excel.run can only run in a JavaScript engine embedded in Office, so it can't run in a web worker. Could you provide more info about your scenario? I suspect that you could do what you want in a single Excel.run. – Rick Kirkham Sep 30 '22 at 19:51
  • I've wrapped everything in an `Excel.run`, but still get wait for previous operation to complete if for exemple there will be 500-1000 parallel `context.sync()` calls – user1532809 Oct 05 '22 at 12:45
  • What do you think I should further try? – user1532809 Oct 05 '22 at 12:46
  • Do you have a sample which has a huge amount of formulas like 200.000 formulas? – user1532809 Oct 05 '22 at 14:03
  • Btw, I had for ex: 1500 formulas with `range.load()` and only one `context.sync()` call, but it failed with wait for previous operation to complete – user1532809 Oct 05 '22 at 14:38
  • Most important is if you can somehow add a functionality to update excel from a webworker because having to much stuff doing on the UI thread will block scrolling and overall functionality of excel. – user1532809 Oct 05 '22 at 14:40
  • Our usecase is: 0. return 1000 promises from a custom function 1. Have 1000 requests. 2. add/remove bingings 3. update promises values This operations kind of terminate excel and freezes everything – user1532809 Oct 05 '22 at 14:45
  • You should not be calling context.sync that often. See https://learn.microsoft.com/en-us/office/dev/add-ins/concepts/correlated-objects-pattern – Rick Kirkham Oct 05 '22 at 18:36

0 Answers0