Forum Discussion

mazi42's avatar
mazi42
New Member
6 years ago
Solved

How to ignore bad URL address on importing data from multiple websites?

Hi!

I have a list of URL addresses of different websites with same type of data. When I try to import it, the process stops if it finds bad URL address and raise an error. How can I ignore or skip bad URL address error so the process would continue to the end?

Thx, mazi42

  • The normal error handling in Power Query is the try-otherwise construct. I'm not sure if it would work on the original source, but cannot hurt to try!

     

    Normally you'd use it in a formula like this:

    try [Date] + 4 otherwise 0

    Adding an integer to a date always produces an error. Instead of returning an error, this returns 0. You can read more about it here.

     

    Note you can use 'try' without 'otherwise' and it will return a record you can selectively analyze and expand too. You can evaluate the "HasError" component of the record in a subsequent formula and then do what you want with the Value component if there is no error, or the Error component if there is.

1 Reply

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    The normal error handling in Power Query is the try-otherwise construct. I'm not sure if it would work on the original source, but cannot hurt to try!

     

    Normally you'd use it in a formula like this:

    try [Date] + 4 otherwise 0

    Adding an integer to a date always produces an error. Instead of returning an error, this returns 0. You can read more about it here.

     

    Note you can use 'try' without 'otherwise' and it will return a record you can selectively analyze and expand too. You can evaluate the "HasError" component of the record in a subsequent formula and then do what you want with the Value component if there is no error, or the Error component if there is.