How to determine when all Loading Data operations are finished?
Asked Answered
T

7

7

I have a Sheets spreadsheet that has many cells that use a custom function which calls IMPORTHTML and parses the results. Other calculations in the sheet use the returned values from these custom formula cells. As expected, when the custom formula cells are calculating they show a "Loading Data..." error message. I can't trust the results of the dependent calculations until the Loading Data operations are complete. Is there any good way to know when all Loading Data operations within a range are complete?

Tupiguarani answered 26/10, 2018 at 14:23 Comment(0)
H
3

I had the same issue.

cell1 : url

cell2 : uses url in importdata

cell3 : uses cell2 in importdata

A mess of chained results, I know.

So I tested all the options I could find around.

Judge by yourself. On the animation, I change the url so it causes a new query and you can see how the different checkers are affected while the data is retrieved.

enter image description here

Here are the queries for your convenience.

=IFNA(E27,"Waiting for data")
=IFERROR(E27,"Waiting for data")
=If(ISERROR(E27),"Waiting for data",E27)
=IF(E27<>"",E27,"Waiting for data")
=COUNTIF(E27,"<>*")

If you have many of these, you may want to avoid recalculations (tons of http requests in parallel). For that look into https://mcmap.net/q/1622686/-how-to-make-google-sheet-formula-just-calculate-once

Heritor answered 21/4, 2021 at 12:4 Comment(0)
P
3

This worked for me:

=COUNTIF(B1:B565,"<>*")

to count the number of cells exhibiting "Loading..." when using the =IMPORTXML() google sheet function. For example, in one particular situation I had 565 links in the first column and the formula =IMPORTXML(A1,"//h2[@class='margin-bottom-50']") in column 2 and placed the formula above into D1. I double-checked by dragging =countif(B1,"<>*") down column 3 to visually check, and then using =SUM() to add all the 1's in that column.

Parapodium answered 7/9, 2020 at 15:29 Comment(0)
H
3

I had the same issue.

cell1 : url

cell2 : uses url in importdata

cell3 : uses cell2 in importdata

A mess of chained results, I know.

So I tested all the options I could find around.

Judge by yourself. On the animation, I change the url so it causes a new query and you can see how the different checkers are affected while the data is retrieved.

enter image description here

Here are the queries for your convenience.

=IFNA(E27,"Waiting for data")
=IFERROR(E27,"Waiting for data")
=If(ISERROR(E27),"Waiting for data",E27)
=IF(E27<>"",E27,"Waiting for data")
=COUNTIF(E27,"<>*")

If you have many of these, you may want to avoid recalculations (tons of http requests in parallel). For that look into https://mcmap.net/q/1622686/-how-to-make-google-sheet-formula-just-calculate-once

Heritor answered 21/4, 2021 at 12:4 Comment(0)
T
1

Let's say the "Loading Data" errors can be found in Sheet1, which is made up of columns A-Z and rows 1-1000. In Sheet2!A1 you could put =IF(COUNTIF(Sheet1!A:Z,"#Loading Data..."),"Loading","Done"). (Replace Z in A:Z with the last column.) If any cells in Sheet1 are returning "#Loading Data..." then the countif will count them, and return "Loading"; else it will return "Done".

(Note: Is the error message exactly what I used? I can't test this at the moment and I'm not sure that's exactly the output)

Trelu answered 26/10, 2018 at 22:45 Comment(1)
Thanks for the help, but it's not working for me. The error message is "Loading Data..." but the cell displays "Loading...". I've tried both but neither is returning true regardless of state. Since my data is numeric, I've used a countif <> 0 function and compared it to the number of cells in the range.Tupiguarani
M
0

try IF(IsError(a:Z),"Not Ready Yet","Ready")

Magnetite answered 7/5, 2020 at 2:22 Comment(0)
L
0

With a Query function it is possible. Assuming the importhtml functions in column E and a data model that returns e.g. URLs, a counter could be constructed that would be set to 0 when all the scraping functions have been completed:

=Count(E1:E)-query(E1:E; "Select count(E) where E contains 'http' label count(E)''")

In case it is another model of retrieved data, you could combine the Query function with regular expressions that match the text or string pattern of the cells.

With a Google Apps Script you could create a rule that alerts you with an email when the target cell equals 0, so you already have a warning of scraping completion.

Loaded answered 15/1, 2022 at 10:43 Comment(0)
M
0

You can use ERROR.TYPE(cell with import formula) now.

ERROR.TYPE(cell with import formula)=10 means it's still loading. If it returns N/A, that means it's done.

Mohave answered 27/10, 2022 at 23:23 Comment(0)
L
0

Use this, it will accommodate multiple columns/rows in the range. =IF(SUMPRODUCT(ISERROR(range))>0,"Loading","Ready")

Unfortunately, =COUNTIF(range,"<>*") will count the blank cells in the range after it has loaded.

Lolita answered 17/8, 2023 at 22:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.