Google Script progress bar

I am using call script to call a script that fetch data from appsheet tables and use the data to create a bill of quantity in  google sheet and then save the google sheet in google drive. users can then view the link to the file in the app and click on the link top view the sheet.

Problem is that the script takes a while to complete and I need a progess bar to let the user know when the document is ready. Please point me where I can find information that will help me build the progress bar

Solved Solved
0 3 2,114
1 ACCEPTED SOLUTION

This is how I implemented it. 

0)  Find, online, a free GIF that will work as your busy indicator.

1)  Add to table column named "Processing?".

2) Create an Image type Virtual Column and set its App Formula to:

IF ([Processing?] = TRUE,
"<<insert URL to GIF image here>>",
""
)

I am not sure I needed the IF() expression - possible only needed the URL.  Just haven't played more it to confirm.

3)  Set Show property of Image Virtual Column to [Processing?] = TRUE

4)  For any long-running activity on that row where you want to show the busy indicator, use an action to set the Processing Flag column to TRUE. 

For example, I show the busy indicator when a new row is inserted because I have several API automation processes that are kicked off independent of the row insertion.  User needs to know processing is still happening.  I also show the indicator when a request to generate a PDF Report is submitted.

View solution in original post

3 REPLIES 3

First, AppSheet does not have any kind of Progress Bar display.   You'd have to construct your own. 

Second, for proper Progress Bar updating, the app would need to get periodic "signals" from the script to be able to update the progress bar. Calls to scripts can only get a return value once the script has completed. Scripts can update a sheet datasource periodically for progress but because there is no "near real-time" updates between the datasource and the app, getting timely "signals" for progress bar updates in the app itself is impossible.

If you are OK with the time it takes for script progress updates ONLY being provided through the app Syncs,  then you can likely simulate a Progress Bar.  For the visual part, you can use SVG's to construct a custom image that accepts data inputs to update the image.  You can find a lot of info about SVG's with a search in the forum.

Lastly, something fairly simple to do is build a "busy" indicator, if that is all you need.  I have done this including a animated GIF image that is just a circle of dots.  When I submit the activity, I set a flag to show the GIF image.  Once the activity finishes, I reset the flag to hide the image.  The only problem I have encountered is when the action to reset the flag doesn't execute because of an error.  The busy indicator stays shown indefinitely.  This may not be as much of an issue from a script.

I hope this helps!

 

Thanks mate, the busy indicator should do the trick. Can you elaborate a bit more on how to achieve this please.

 

This is how I implemented it. 

0)  Find, online, a free GIF that will work as your busy indicator.

1)  Add to table column named "Processing?".

2) Create an Image type Virtual Column and set its App Formula to:

IF ([Processing?] = TRUE,
"<<insert URL to GIF image here>>",
""
)

I am not sure I needed the IF() expression - possible only needed the URL.  Just haven't played more it to confirm.

3)  Set Show property of Image Virtual Column to [Processing?] = TRUE

4)  For any long-running activity on that row where you want to show the busy indicator, use an action to set the Processing Flag column to TRUE. 

For example, I show the busy indicator when a new row is inserted because I have several API automation processes that are kicked off independent of the row insertion.  User needs to know processing is still happening.  I also show the indicator when a request to generate a PDF Report is submitted.

Top Labels in this Space