Force mobile implementation for Google Sheets - google-apps-script

I've noticed that a tab on a particular Google Sheet we've developed 'runs' a lot faster (about 70-80 times faster) on a mobile than on a desktop - ie it calculates and returns its results faster. The one tab in particular that uses a query to filter a master database. I surmise that this is because there's a very reduced 'view' window on a mobile and Google Apps cleverly off loads the heavy lifting to its servers when it sees a mobile opening the sheet.
My question is, and this is speculation, can I use a script to force a particular Google Sheet to always report to the Google Servers that it's running on a mobile?

Related

Google Sheets Debugging Endless Calculations and Slow Load Time (Chrome Dev Tools)

Working with a Google Sheet that has grown in complexity and size over time and is now calculating endlessly and really slow to open. The sheet has a large amount of data, formulas and import ranges.
I have read best practices on how to speed up sheets link. Does anyone know how to do advanced trouble shooting in Chrome Dev tools to see what formulas are running when and help narrow down what could be causing the problem?
I have used Chrome Dev Tools and the Performance Monitor, but can't see how to locate actual formula [Ex: Sum() or VLOOKUP()] names/location from within the sheet since they are nested under so many layers of functions. (Ex: Function Call > b > P.I2b > p.$Ma > etc)

Evaluate Google Sheet offline programmatically

What's the best way to evaluate a Google Sheet without using the API? By evaluate I mean, change some cells and recompute the dependent cells.
You can use Google Sheets offline, so they have to be stored somewhere and the evaluation code also needs to run offline. How can I control this functionality from JS/Python?
I need to run thousands of computations as quickly as possible and the API would be too slow for this / I would get rate limited.
You can use Google Sheets offline, so they have to be stored somewhere and the evaluation code also needs to run offline. How can I control this functionality from JS/Python?
For offline support the data must be stored by the browser.
You can use the browser's Developer console to inspect the data-stores supported by that browser (ie. IndexedDB, Local Storage, Web SQL, etc.). From what I can see from Google Chrome (go to your developer console and select the Application tab), you can find some google docs data mirrored in IndexedDB databases.
Unfortunately, I don't believe you can interact with that data in any meaningful way outside of the dev console. Plus some of that data appears to be encrypted.
If your goal is to use Google Sheets as a analytics platform to perform heavy computation then you're in for a lot of disappointment. As you're no doubt discovering Google Sheets are bound by a number of limitations and its not meant to be used in that capacity. You probably need something more robust and that means moving to more traditional database solutions, but they wont' be free.
You should consider using normal formulas, this documentation will show you the basics on how to use them for regular data management in the Sheet.
After that, you should see this list of functions to know what tools you have available to create the functionality that you want.
Lastly, you should see this tutorial on creating your own formulas, it can be helpful to expand what the normal functions can do and have a more tailored solution to your needs.

Does Chrome App works with large data like POS?

I am planning to create a POS System using Chrome App and Indexed DB as the backend. I just want to know if it could cater/work with large data.
Let's say that this app will be used in a big restaurant that has a thousands of transactions per day and a thousand of Inventory list with image of each item.
Thanks in advance!
I don't think the Chrome App per se will be the problem. It's where you store your data that needs scaling. For that Google has Google Cloud Platform, built automatically for scaling.
Several businesses are already using Chrome Apps. Check this list of Chrome apps being used for work. Who knows if your app will also be added to the list.

Google Apps Script close spreadsheets programmatically

Google lists a maximum of 50 concurrent users allowed edit permission at once in a shared spreadsheet
https://support.google.com/docs/answer/2494827?hl=en&rd=1
I've got a Google Spreadsheet that will have a large number of potential editors at any moment and am concerned about idle users filling up the 50 cap and blocking edits from fresh logons. There's a lot of interaction with the data that discourages me from using Forms submissions, and there would be a large bound script to the document.
Is there an idle timeout function that can be called through the spreadsheet's bound script that will close the document or set an idle user to view only status? This is in a Google Apps for Business domain.
This is a question that was asked very often 6 years ago on the old Google product forum when I began to work with Google spreadsheets.
Strangely the question disappeared after a while and never came back (until today !)
There are two main reasons for this question to disappear :
Since Google spreadsheets are a representation of a documents hosted on a distant server, we can not interact with what happens in another user browser from a script that runs on this distant server
I suppose this is rarely an issue and that in most case it was mainly a theoretical question that vanished in real use. (but that is really a supposition, I admit...)
As far as I know there is no practical solution to avoid that situation.

Google Apps Script gadgets - what's loading when?

I've seen inconsistent load times for Google Apps Script gadgets on my Google Sites. There seem to be two visible phases to the gadget loading process - a "blank" period, and a period with a "loading" animation. Can anyone explain the relationship between these two phases? I suspect but have no way of knowing that my code does not begin to execute until the loading animation is complete. Is this true?
My scripts seem to perform relatively consistently once they reach the loading animation. I have reviewed the available documentation on optimizing performance for Google Apps Scripts, and I have been able to get reasonable load times for my requirements, but the gadget sometimes spends a long time - over 60 seconds - with no content prior to the loading animation appearing.
I have one page with three Google Apps Script gadgets on them, with three very different performance profiles. I am loading data from a spreadsheet in two of them, but I need to iterate through Google Contacts in another which takes quite a bit longer. It appears to me that once one of these scripts hits the "loading" animation, they all begin executing fairly quickly, but nothing I do as a developer influences the time prior to the loading animation.
Web browsers are single threaded when doing server calls in Javascript (or GAS) so it needs to complete all of your function calls to the server before it can return the values from the server and render your page. A workaround would be to create a simple button on the page to start your GAS processes then have a loading screen come up via a clienthandler when the button is pressed. The load screen will be visible as the processes are going on in the background and when you finally finish your processes, you can set the load screen (panel) visibility to false.
Not the most elegant solution, but your initial page will render quickly then you an set a panel (with an animated gif loading graphic if you prefer) to tell the user the page is loading.
Hope this helps!
Interesting question. But I'm afraid there's really nothing else that we can do.
Well, besides complaining with Google :)
I guess you should open an "Enhancement request" on the issue tracker.