Asynchronous
If you want to retrieve data from a web page then the custom function needs to be asynchronous.
When calling external web services you must do the following:
Return a JavaScript Promise to Excel
Make the http request to call the external service
Resolve the promise using the setResult callback to send the values to Excel.
function method_from_server(arg1) {
return Excel.Promise( function (setResult, setError) {
getSomethingFromServer_Method(arg1, function(data) { setResult(data.returnedobject); });
});
}
function method_from_server(arg1){
return new OfficeExtension.Promise(function(setResult, setError){
getSomethingFromServer_Method(arg1, function(data) {
setResult(data.returnedobject);
});
});
}
© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext