Script when opening in the mobile version of Google Sheets - google-apps-script

It is necessary that, in the mobile version of the Google spreadsheet (on a mobile phone), the script scrolls / activates the bottom cell of the table.
In the desktop version of Google Spreadsheets It works!! :
var ss=SpreadsheetApp.getActiveSpreadsheet();
ss.setActiveSelection('A'+ss.getLastRow());
SpreadsheetApp.flush();
But this script does not work in a mobile phone (maybe due to the reduced capabilities of the mobile version of the table).
But still I hope - Connoisseurs will prompt me something!

Long story short, onOpen() triggers do not work on mobile (as stated by Ryan), nor is there an AppScript or Macro menu. One thing that does work, though, is onEdit() triggers.
From my experience, the only way to accomplish something like this would be to implement an onEdit() function with a checkbox. This method would not be automatic when opening the sheet, but upon opening the sheet on mobile, the user could then check off that box, and the script would run. Let me know if this is a method you would be interested in trying out, and I can edit this post to provide you with some code (I am not providing it initially since it doesn't really answer your question or truly solve your issue).

This probably isn't an issue with your code but the fact that googles mobile apps don't support Google Script or their triggers, Try using the mobile browser view of google sheets that might work.

Related

Clear certain cells on Window Close AppScript

I wanted an appscript mechanism, where I want to clear certain cells (A2:B8) if the spreadsheet window is closed. I have one way of doing it and that is:
onOpen()
{
sheet.getRange("A2:B8").setValues("");
}
But this seems like a hack but I wanted to know if there's a definite way to do so... like for example:
Browser.onWindowClose()=>{clearCells()}
You maybe able to do this if you have a modal dialog or sidebar open. If sidebar or dialog close is attempted, you may be able to catch the event with beforeunload, if catched, clear all cells using google.script.run(). This assumes user is closing the sidebar before/along with the Google sheets main web app.
There isn't onClose() or onExit() built in trigger as of yet.
Here is the list with all the currently available triggers.
The lack of this feature has already been reported in the IssueTracker.
You can go there and click on the star button to the top left of the page to "increase" the chances for this feature to be implemented by google.
As a side note, clearContent() would be more appropriate:
sheet.getRange("A2:B8").clearContent();

Is there a way to remove big blue bar on top of google documents after running a script using google apps script

I am creating a google apps script for a private reason but this is nothing about the code. If you are confused by the title, I will explain what I mean:
I'm pretty sure most google drive users have used add-ons before. When you launch an addon, it runs a script. Perfectly normal, but the thing is, you don't know when it is running a script because there isn't anything indicating it. What I want is to hide that big blue bar that appears when you run a script.
I tried looking at Google Apps Script's website but if you tried searching something like this on the web, your browser won't understand you which is why I decided to use stack overflow.
Here is a picture of what I want to get rid of:
as you can see here the I want to hide the "Finished Script" thing using Google Apps Script or some other way.
Based from this blog, as soon as you click the Apps Script button, you’ll see a yellow bar "Running function <function-name>". This will indicate that the script is running. When done, the bar will read “Finished Script”. This is a built-in Google Apps Script feature. I think you will not be able to remove this feature.

How to enable Google Sheet Script to work on Mobile?

I hope you can help.
I have set up a google Sheet script that merges and fills the cell once the button is clicked (registration schedule).
It works fine on the desktop, however, when I open the sheet on iOS Google Sheets app and click on the button it only selects the item.
Do I need to enable it to be live on mobile? Is it possible?
The only functions that can be triggered on mobile are onEdit() and onOpen() functions.
However, here is a workaround that you can try.

image click on mobile inside the sheets app

I have a custom script that runs when i click an image i insert in a google spreadsheet ... everything is working on non-touch devices ... but on mobile, inside the sheets app, it does no trigger the function ... it just selects the image
am i doing anything wrong here?
are google script supposed to work inside the sheets app? if not i really do no see the point of using them
link is not the solution, custom menus also do not appear on the sheets app ... i am literally left without any idea to try out
thanks
As far as I know Google Apps Script runs only on Desktop computer and that too only when Script is allowed to run on your browser. For most part Google Apps Script is same as JavaScript. I have tried to run them on Android phones but without any success.

How to use FastButtons for them to work on mobile devices?

I have read this (and other relating things also):
https://developers.google.com/mobile/articles/fast_buttons?hl=fi#conclusion
but I don't understand how to use this in Google Apps Script. I made the UI with GUI Builder and now I want the buttons to work also on mobile devices.
Could someone please explain to me with a code example of how to change my buttons to work also on mobile devices?
Code that works Ok on PC but not on mobile device:
var handler109 = app.createServerClickHandler('func109');
var but109 = app.getElementById('Button109');
but109.addClickHandler(handler109);
How to use Client Handler? app.createClientHandler('func109') generates an error, app.createClientClickHandler('func109') generates an error... How do I define that function func109 should be called?
var handler109 = app.createClientHandler();
var but109 = app.getElementById('Button109');
but109.addClickHandler(handler109);
First, the article you've shared is applicable for mobile and not so much for Google Apps Scripts.
However, the buttons you make in Google Apps Script WILL work on mobile devices too. However, if you only have a server handler set up on the button, it will take a noticeable period of time before the action of the button is seen by the user.
Google Apps Script also has client handlers which you can use which show up a much faster response than server handlers.
Issue 1086 might be relevant in your case