0

I'm sorry if this question has been asked before, I searched on SO, but couldn't find it. Currently I'm doing things such as:

=
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE()),
))))))))

But I'd like to have a formula which does:

RETRY_IFERROR(SOME_GET_REQUEST_TO_3RDPARTY_SERVICE(), 8)

Does such a formula exist? If not, how would one create it in Google Apps Script? I did find some inspiration on how to do it in Google Apps Script (see Use existing spreadsheet formulas in a custom formula in google docs/spreadsheets ).

Melvin Roest
  • 1,392
  • 1
  • 15
  • 31
  • 1
    What kind of formula is the 'some_formula'? And what causes the error? Eq what kind of error do you get? Give some more context please. Btw.. you're supposed formula is missing some logic. IF there is a error then what does it needs to retry? The same formula will just give the same result: error – RemcoE33 Dec 27 '20 at 19:20
  • The formula is a GET request, which sometimes fails for reasons that only CloudFlare knows. It's a 3rd party service out of my control. It almost always works after a couple of retries. – Melvin Roest Dec 27 '20 at 20:30
  • You need to be more specific to get an answer I am afraid. You are also talking about scripts. Is your formula built based on a custom function ? Also, `iferror` is a binary checker. It can return two values. Why exactly do you want to apply `iferror` 8 times or in fact more than once. If the formula inside returns an error then `iferror` will give you the corresponding output. Help the community to help you, that's the idea in this platform. – Marios Dec 27 '20 at 20:31
  • The GET request is custom, but in principal it could also be a specific Google GET request (e.g. `GOOGLEFINANCE()` ), simply because those can fail as well because of network connectivity reasons. – Melvin Roest Dec 27 '20 at 20:33
  • @MelvinRoest if the formula comes from a custom google apps script function then why don't you use a `try..catch` statement in your script to catch such errors? What kind of connectivity reasons are you referring to? – Marios Dec 27 '20 at 20:43

0 Answers0