Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to get spreadsheet with apps script working on mobile browser

293 views
Skip to first unread message

Sporting Antwerpen

unread,
Mar 18, 2025, 8:45:30 AMMar 18
to Google Apps Script Community
Hi everyone
I am completely new to Apps Script and have entered this wonderful world for a digital project. In the meantime, I have already looked up various things, tested and read quite a few help texts in function of my project. But so far I always get stuck somewhere. My project is the following: I want to create a simple counter with a button that gives an output in a cell in the form of a +1 every time it is clicked. The intention is that this will then end up in a kind of online magazine via embedding. I managed to create the button (thanks to consulting a lot of online documentation and tutorials 😊 ) in Google Sheets. This via a drawn shape linked to a self-made apps script with the name 'Challengeteller_v2'. I can perfectly embed this button in Google Sheets with the link in the online magazine and then it works fine. What I am now stuck on is the fact that the embedded link to the Google Sheet does not work on mobile. Through online documentation I have already discovered that a setup with button function like mine does not work well on mobile. The workaround with a checkbox and linked script does work, but only in the Spreadsheets app and not in the browser. Since many people from the target group will visit our online magazine on mobile via their browser, I am still looking for a solution for that. Can someone maybe provide me with a proper solution or help me on the way? Here is the link to the spreadsheet and the linked apps script ‘Challengeteller_v2’: https://docs.google.com/spreadsheets/d/1KmrtOMtUnJduH51guM3ZkuQXslcxE-6YMZLBnyZ8EXI/edit?usp=sharing
Thanks in advance!
Best regards
Jan

George Ghanem

unread,
Mar 18, 2025, 1:16:22 PMMar 18
to google-apps-sc...@googlegroups.com

Yes, Apps-Script do not work on mobile unfortunately. One option for you is to do a Webapp and provide the functionality that way. Webapps do work on mobiles but will involve you putting together your content via an HTML page.


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/8782266a-adb6-48c8-bbcc-32a8f682a518n%40googlegroups.com.

Brent Guttmann

unread,
Mar 18, 2025, 9:24:47 PMMar 18
to Google Apps Script Community
A drop down plus onEdit() works on mobile... could probably also change the browser to "desktop view" but i wouldn't suggest using it for mobile first use.... just for ones offs. As suggested, a webapp plus iframe in google sites would work if you really want appscript.  

Sporting Antwerpen

unread,
Mar 19, 2025, 6:28:16 AMMar 19
to google-apps-sc...@googlegroups.com
Hi George
Thanks for the quick response. In the meantime I've managed to create a web-app that works through a HTML-page, so no bounds with Spreadsheet, just scripting code and html. It works fine when I go to the webapp url logged in with our Google account (as owner of the script and webapp). But when I go to the webapp logged in with another Google-account or as a guest, it remains blank... Nevertheless I think I've set all the sharing options in the webapp's project settings right and open to everyone (webapp execute as 'me' and access open to everyone). 
Any thoughts?
Best regards
Jan

Op di 18 mrt 2025 om 18:16 schreef George Ghanem <ggha...@gmail.com>:
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/Qeg1mAkvbSg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/CAA4K68ZFffKYnUC7xPxmgOxucVoUzKW%2BCgKdYhAPEHs_pj7eGg%40mail.gmail.com.

Sporting Antwerpen

unread,
Mar 19, 2025, 6:33:08 AMMar 19
to google-apps-sc...@googlegroups.com
Hi Brent
Thanks for the quick reply.
I've tried to embed the spreadsheet in a Google Site and then embed it to our online magazine. But Google Sites cannot be embed I've found. So the Iframing of the webapp in a Google Site would work, but the further embedding won't, I think.
Best regards
Jan

Op wo 19 mrt 2025 om 02:25 schreef Brent Guttmann <brent.g...@toptierpa.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/Qeg1mAkvbSg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.

Brent Guttmann

unread,
Mar 19, 2025, 9:10:15 AMMar 19
to google-apps-sc...@googlegroups.com
Try going to it in incognito mode or after logging out of google and clearing browser cache. I know that for me, I have problems if I am logged into multiple accounts. (Even if they are separate chrome instances)

Sporting Antwerpen

unread,
Mar 19, 2025, 10:16:55 AMMar 19
to google-apps-sc...@googlegroups.com
Hi Brent
Thanks for the suggestion! I've tried in incognito mode and then the script is working indeed. However, when I embed the script link into the software in the same incognito window, it  keeps telling me that I don't have access. Maybe I need to add something in the script about access or authorization?

Op wo 19 mrt 2025 om 14:10 schreef Brent Guttmann <brent.g...@toptierpa.com>:

Brent Guttmann

unread,
Mar 19, 2025, 11:06:20 AMMar 19
to google-apps-sc...@googlegroups.com
Make sure your doGet() function has these 'modes' set:

function doGet() {
    return HtmlService.createHtmlOutput(generateHTML())
        .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
        .setSandboxMode(HtmlService.SandboxMode.IFRAME);
}

On Wed, Mar 19, 2025 at 10:16 AM Sporting Antwerpen <communica...@gmail.com> wrote:
Hi Brent
Thanks for the suggestion! I've tried in incognito mode and then the script is working indeed. However, when I embed the script link into the software in the same incognito window, it  keeps telling me that I don't have access. Maybe I need to add something in the script about access or authorization?

Op wo 19 mrt 2025 om 14:10 schreef Brent Guttmann <brent.g...@toptierpa.com>:
Try going to it in incognito mode or after logging out of google and clearing browser cache. I know that for me, I have problems if I am logged into multiple accounts. (Even if they are separate chrome instances)

Sporting Antwerpen

unread,
Mar 19, 2025, 12:08:15 PMMar 19
to google-apps-sc...@googlegroups.com
Hi Brent
When I put this in like this I'll get the following error in return: syntax error: syntaxError: Illegal return statement line: 1 file: code.gs...
Sorry for the inconvenience. I'm totally new to the scripting :-s

Op wo 19 mrt 2025 om 16:06 schreef Brent Guttmann <brent.g...@toptierpa.com>:

Brent Guttmann

unread,
Mar 19, 2025, 12:31:01 PMMar 19
to google-apps-sc...@googlegroups.com
For whatever reason when I copied and pasted the function, the letter f got changed to something strange. To fix it, just remove the letter f and then type it in again.

You also need to replace "generateHTML" with whatever function you are using to return the html content.


On Wed, Mar 19, 2025 at 12:08 PM Sporting Antwerpen <communica...@gmail.com> wrote:
Hi Brent
When I put this in like this I'll get the following error in return: syntax error: syntaxError: Illegal return statement line: 1 file: code.gs...
Sorry for the inconvenience. I'm totally new to the scripting :-s
Op wo 19 mrt 2025 om 16:06 schreef Brent Guttmann <brent.g...@toptierpa.com>:
Make sure your doGet() function has these 'modes' set:

function doGet() {
    return HtmlService.createHtmlOutput(generateHTML())
        .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
        .setSandboxMode(HtmlService.SandboxMode.IFRAME);
}

George Ghanem

unread,
Mar 19, 2025, 9:28:31 PMMar 19
to google-apps-sc...@googlegroups.com
Google still has difficulties providing access to a webapp if the user is logged into multiple Gmail accounts on that browser. 

Try using a different browser from the one you use for Google log ins.

Sporting Antwerpen

unread,
Mar 20, 2025, 6:25:57 AMMar 20
to google-apps-sc...@googlegroups.com
Hi Brent & George
With the adjustments the code is still working in other browsers and in incognito mode. BUT when embedded, it still gives the same screen: you need access... Thanks a lot for the help so far, but it's clear that Google has difficulties providing access to a webapp...
Best regards  
Jan

Op wo 19 mrt 2025 om 17:31 schreef Brent Guttmann <brent.g...@toptierpa.com>:

Brent Guttmann

unread,
Mar 20, 2025, 10:01:37 AMMar 20
to google-apps-sc...@googlegroups.com
If it's working in incognito mode then it should work for other people. It sounds like this is a problem for you specifically, when logged into multiple accounts. It's also possible that chrome extensions are causing it.

George Ghanem

unread,
Mar 20, 2025, 1:22:06 PMMar 20
to google-apps-sc...@googlegroups.com
Hi,

Can you share the code of your webapp? I can take a peak to see what is going on.

Also, where are you embedding the webapp and what code did you use for the embedding?


Sporting Antwerpen

unread,
Mar 21, 2025, 6:50:31 AMMar 21
to google-apps-sc...@googlegroups.com
I think the script is working indeed. Thanks a lot for the help with it. Only thing that still causes problems is the embedding of it...

Op do 20 mrt 2025 om 15:01 schreef Brent Guttmann <brent.g...@toptierpa.com>:

Sporting Antwerpen

unread,
Mar 21, 2025, 9:15:02 AMMar 21
to google-apps-sc...@googlegroups.com
Hi George
Certainly! Underneath you'll find the link to working web-app and the script.
I tried to embed it as an external url into the online magazine software (https://www.maglr.com/) in different web browsers (logged in as myself on Google and in incognito mode), but also in a Google Site. I've tried to iFrame the web-app in an online code editor. All with the same outcome: the window of Google Drive appearing saying I need access to the document...

Underneath you'll find the code of the script:

function doGet() {
  var scriptProperties = PropertiesService.getScriptProperties();
  var count = scriptProperties.getProperty('count');
  if (!count) {
    count = 0;
  }
  var template = HtmlService.createTemplateFromFile('Teller');
  template.count = parseInt(count, 10);
  return template.evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}

function incrementCounter() {
  var scriptProperties = PropertiesService.getScriptProperties();
  var count = scriptProperties.getProperty('count');
  if (!count) {
    count = 0;
  }
  count++;
  scriptProperties.setProperty('count', count);
  return count;
}

Thanks in advance!


Op do 20 mrt 2025 om 18:22 schreef George Ghanem <ggha...@gmail.com>:

Brent Guttmann

unread,
Mar 21, 2025, 1:17:50 PMMar 21
to google-apps-sc...@googlegroups.com

Sporting Antwerpen

unread,
Mar 24, 2025, 4:27:19 AMMar 24
to google-apps-sc...@googlegroups.com
Hi Brent
I think the dev and exec tip was the golden oné: it works finally!! Many thanks for all the help.
Best regards!
Jan

Op vr 21 mrt 2025 om 18:17 schreef Brent Guttmann <brent.g...@toptierpa.com>:

George Ghanem

unread,
Mar 24, 2025, 1:41:20 PMMar 24
to google-apps-sc...@googlegroups.com
Glad you got it working. Yes, an iframe is needed for the embedding.


Sporting Antwerpen

unread,
Mar 25, 2025, 6:17:18 AMMar 25
to google-apps-sc...@googlegroups.com
Thanks again for all the help.

Op ma 24 mrt 2025 om 18:41 schreef George Ghanem <ggha...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages