Create a Button that works in mobile in Google Sheets

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 140

  • @jman2150
    @jman2150 7 місяців тому +7

    I feel like it's rare that I am trying to do something and I find the exact solution spelled out exactly how I wanted it to work. Thanks!!

    • @practicalsheets
      @practicalsheets  7 місяців тому +1

      What a kind comment. Thank you so much!

  • @PAPAgence
    @PAPAgence Рік тому +4

    My god I've been searching for this fo soooo long. It works perfectly well on my phone, and will help all of my coworkers. Thank you so much for sharing this !!!

  • @GustavoKallas-p2b
    @GustavoKallas-p2b 9 місяців тому +1

    Thank you so much! Excelent information and explanation. Many thanks...

  • @MrEcoMen
    @MrEcoMen 8 місяців тому +1

    Simple and fantastic. Thank you

  • @vamsikrishna-zt1cy
    @vamsikrishna-zt1cy 6 місяців тому +1

    Great one, super helpful. I tried to make the button work in mobile but met a dead end. Amazing bro🎉

    • @practicalsheets
      @practicalsheets  6 місяців тому

      Thank you!
      Any specific error?

    • @janr.9343
      @janr.9343 6 місяців тому

      You cannot trigger the event via the button on a mobile device! That is why he proposed the workaround with the onEdit(e) function which works perfectly.

  • @lafamillecarrington
    @lafamillecarrington Рік тому +1

    Useful to know that there is a relatively simple workaround.
    Thanks.

  • @nimconrod
    @nimconrod 8 місяців тому +1

    Very clever workaround, thank you

  • @mrdeerz4195
    @mrdeerz4195 3 місяці тому +1

    automatic subs and like for you.. the best guide ever, thank you very much..

    • @practicalsheets
      @practicalsheets  3 місяці тому

      Thank you for the kind words!

    • @mrdeerz4195
      @mrdeerz4195 3 місяці тому +1

      @@practicalsheets I want to ask about how to make a clickbox with onEdit that can add up (eg. 100+ 200) between 2 columns, and place the result in the colomn..thank you very much

    • @practicalsheets
      @practicalsheets  3 місяці тому

      @@mrdeerz4195 In this example the checkbox would be in col C, and it would add values in col A and col B, and paste the result in col D
      function onEdit() {
      let activeCell = SpreadsheetApp.getActiveSpreadsheet().getActiveCell()
      let column = activeCell.getColumn()
      let sheetName = activeCell.getSheet().getName()
      let activeValue = activeCell.getValue()
      if (column == 3 && sheetName == "Counter" && activeValue == true) {
      activeCell.offset(0,1).setValue(activeCell.offset(0,-2).getValue()+activeCell.offset(0,-1).getValue())
      activeCell.setValue(false)
      }
      }
      Hope it is useful

    • @mrdeerz4195
      @mrdeerz4195 3 місяці тому

      Thank you very much @practicalsheets ...
      Im sory if im wrong.. But what i mean is ..
      How to add up / sum (eg. My clickbox in C3.. i want to add C5 number + D3 number and paste the result in D3 too..)
      pls help me.. 🙏🏻

    • @mrdeerz4195
      @mrdeerz4195 3 місяці тому

      @@practicalsheets pls help me ..🙏🏻

  • @so_slow
    @so_slow Рік тому +1

    thank you so much this works so well!

  • @lubosklimek
    @lubosklimek 3 місяці тому +1

    Thank you very much. Excelent. Working on 100%.

    • @practicalsheets
      @practicalsheets  3 місяці тому

      Thanks for commenting! Glad it's useful
      Kind Regards

  • @GoranGoran-p2z
    @GoranGoran-p2z 10 місяців тому +1

    Very usefull, thx. Is it possible to use this way for more check boxes and every check box should counting different cell?

  • @namta6696
    @namta6696 11 місяців тому

    It's very helpful. Thank you very much.

  • @sanjaymanjhi9464
    @sanjaymanjhi9464 2 місяці тому +1

    Awesome👍👍👍👍

  • @EvanWargon
    @EvanWargon 11 місяців тому

    Lovely solution, and very easy-to-follow tutorial. Thank you! :D

  • @sbarbee1979
    @sbarbee1979 Рік тому +2

    This video was great and easy to follow along. Much appreciated actually talking through the meaning of the commands used also!
    This seems like the ideal fix for my situation , but I was unable to get it to work in the last step (with the checkbox). My script runs within the basic onEdit function, but when I try to tie it to the specific trigger, it no longer executes (nothing happens). I've compared my code to the video's 5-6 times and don't see any differences. Thoughts?

    • @practicalsheets
      @practicalsheets  Рік тому +1

      Please let me see your code to see if we can find the mistake
      Regards!

  • @SilverPazuzu
    @SilverPazuzu Рік тому

    Amazing, this helped me a lot! :)

  • @aaronbitton9310
    @aaronbitton9310 Рік тому +1

    That was incredible! Thank you!

  • @joseluisdelgadoalvan2058
    @joseluisdelgadoalvan2058 7 місяців тому +1

    Gracias, me sacaste de un apuro,....

  • @DimoMinkov
    @DimoMinkov Рік тому +2

    Thanks! How will it be implemented if there are several buttons and correspondingly several scripts (functions) in the table?

    • @racchittt
      @racchittt Рік тому

      same question

    • @jonnybolton4659
      @jonnybolton4659 Рік тому

      You probably need an else if for every other button, where you check if a different combination of sheet name/cell is active, and then you run a different function inside the else if

  • @111bobgato
    @111bobgato 8 місяців тому +1

    I was able to apply your workaround (thanks). But in my case I have multiple cells throughout my spreadsheet that I would like to increment on demand by clicking on a single checkbox (cell B4 in your example). When B4 is checked, rather than adding 1 to cell B2 (in your example), I want the logic to increment the one cell that had focus right before I clicked on the checkbox in cell B4. Do you know of a way to do that? Thanks again

    • @practicalsheets
      @practicalsheets  8 місяців тому

      Mmmm
      Very interesting
      I´m not sure how to do it
      There is a trigger onSelectionChange
      Maybe we could try that but it may make the sheet really "heavy"
      Kind Regards

  • @ashariwumy
    @ashariwumy 4 місяці тому +1

    Thanks, very usefull.
    I will try.

    • @practicalsheets
      @practicalsheets  4 місяці тому

      Excellent!
      Let me know if it works
      Kind Regards

  • @finnigan16
    @finnigan16 Рік тому +1

    Very helpful. Thank you!

  • @mpatey84
    @mpatey84 Рік тому +1

    Thanks for this, I have attempted to utilize this in my script but I have not had any luck getting it to work. I am fairly new to the scripting and I am not sure how to go about troubleshooting, I have copied your script exactly other than the counter. any recommendations would be great.

  • @marcelomasaveuinfante2482
    @marcelomasaveuinfante2482 10 місяців тому

    This has been SO helpfull !! Thank you so much for the video
    NEW SUB !

  • @jonisarowar8424
    @jonisarowar8424 Рік тому +1

    That was amazing!! 😍

  • @crg705
    @crg705 11 місяців тому

    Brilliant - just what I needed - thank you

  • @andrewsworkshop
    @andrewsworkshop 11 місяців тому

    Thank you so much! This worked for me. :)

  • @abuomardontadd2865
    @abuomardontadd2865 10 місяців тому

    thanks if i want to create more buttons which work on mobile what i should do

  • @emmanuelrondon1574
    @emmanuelrondon1574 4 місяці тому +1

    Amazing. I am not an expert, I am looking forward to applying this to a button to redirect me to a different sheet inside the same worksheet. How can we do that?

    • @practicalsheets
      @practicalsheets  3 місяці тому

      Actually, you can do this without having to code.
      I realize I don´t have a video on this. I´ll get into it!
      Kind Regards

  • @joshuasantora4112
    @joshuasantora4112 Рік тому +3

    How can I add multiple buttons to the same sheet like this? I've tried but something is interfering to where the last one in the script code is the only one that's actually functioning.

    • @jonnybolton4659
      @jonnybolton4659 Рік тому

      You probably need an else if for every other button, where you check if a different combination of sheet name/cell is active, and then you run a different function inside the else if

  • @LisaBardwell
    @LisaBardwell 3 місяці тому +1

    Hi, totally new to scripts and able to get the first working fine. I have 7 check boxes I needed to add under function onEdit. I've referenced the check box cell in each case. I still can't get it to work. Again, very new to script. In a Mac, trying to make work on an Iphone. Help?

    • @practicalsheets
      @practicalsheets  3 місяці тому

      Please let me see your code, to see where your mistake may be
      Kind Regards

  • @aghamubasher904
    @aghamubasher904 4 місяці тому +1

    NEED HELP..!
    Thanks for this awesome function. But It works perfect when i have only one button..
    In my case I have two buttons and i have created 2 separate functions and assign each Checkbox a separate function. But when i click the Button A, Nothing happens and When i Click the Button B it works perfectly.
    Please answer the question. Waiting for your reply

    • @practicalsheets
      @practicalsheets  3 місяці тому

      Hello!
      Instead of onEdit, call your function any other thing. Let´s say function1
      Then the other function will be function2
      Finally, include both functions in your onEdit like this
      onEdit(){
      function1()
      function2()
      }
      Hope it helps!

  • @LukasMossum
    @LukasMossum 8 місяців тому +1

    I only get one script to work at a time, I have no clue to why this happens. I want to have several different buttons that clear different seachbars/ranges. and hope to have a on edit timestamp as well. Do you have any idea to why only one of my functions is functional by any chance? Or where I can find out?

    • @practicalsheets
      @practicalsheets  8 місяців тому

      Hello!
      You should have only one onEdit
      And them imside this onEdit you may include all of the functions you want to execute
      Regards!

  • @LostOrStolen
    @LostOrStolen 5 місяців тому +1

    What about a confirmation dialog or popup on mobile? Does that work?

    • @practicalsheets
      @practicalsheets  5 місяців тому

      Unfortunately no
      Regards!

    • @LostOrStolen
      @LostOrStolen 5 місяців тому +1

      @@practicalsheets Thank you. It does work using Desktop mode, but it's super cumbersome.

    • @practicalsheets
      @practicalsheets  5 місяців тому

      @@LostOrStolen You are right. It's horrible!

  • @janssensidehustle
    @janssensidehustle 9 місяців тому +1

    can you add link so we can copy your script, taht would be very helpfull. thanks

    • @practicalsheets
      @practicalsheets  4 місяці тому

      Hello!
      Thanks for the interest
      You may download all templates in the patreon page
      practicalsheets.com/patreon
      Kind Regards

  • @iamcurios
    @iamcurios 5 місяців тому +1

    Dear sir the check box u explained became a tick box and using that I did bit by bit the same, bt it's not at all working on mobile.
    Is there a change I need to do?

    • @practicalsheets
      @practicalsheets  5 місяців тому

      If you want, you could share the code
      Kind Regards

  • @janaklabalova1743
    @janaklabalova1743 7 місяців тому +1

    Hello, if I want for each row function chech box, could you please help me,how to do it? Thank you very much

    • @practicalsheets
      @practicalsheets  7 місяців тому

      Creating the checkboxes is not difficult. The question is what function do you want to execute with each box
      Kind Regards

  • @katherineberger3130
    @katherineberger3130 Рік тому

    Thank you so much! This is exactly what I was looking for :)

  • @tntori5079
    @tntori5079 11 місяців тому

    Fantastic video! I was able to get it to work great on my computer (browser) but alas it's not working on my phone or tablet. Any thoughts? I did swap counter for my own function but it worked on PC no issue there. And if I hit "run" from the scripts page it also worked. 0.o

  • @christophe4604
    @christophe4604 Рік тому

    That's perfect, thanks a lot !

  • @maurobatti
    @maurobatti Рік тому

    Thanks, great idea

  • @brearddominique64400
    @brearddominique64400 Рік тому

    Very interesting. Thanks

  • @26shayankhan
    @26shayankhan 7 місяців тому

    Thanks a lot

  • @berahronah1103
    @berahronah1103 Місяць тому

    The function I want to call with OnEdit takes more than 30 sec to complete, so it got terminated half-way every time when I triggered the OnEdit... Do you have other ways to trigger a function call on a mobile device without the time limitation?

  • @puthdarakim1175
    @puthdarakim1175 Рік тому

    Could you help to use checked box on mobile to move / copy many rows to another sheet

  • @jonnybolton4659
    @jonnybolton4659 Рік тому

    Hi, thanks for this tutorial it's very helpful, I managed to copy it so that my counter function worked on my tablet, however when I replace counter with my own function in the script, it no longer runs... but that function works fine when placed in a button or as a keyboard shortcut.
    Can you think of any limitations on why the onEdit function won't run another function? Would it help if I shared the code for that function with you?

    • @jonnybolton4659
      @jonnybolton4659 Рік тому

      Ahh, I think it's because my function imports data from another file - looks like onEdit cannot access other files? Is there a workaround?

    • @rafaelantoniocamaranhernan2445
      @rafaelantoniocamaranhernan2445 Рік тому

      @@jonnybolton4659 Hi, I was experiencing the same issue. I had the exact same code as the video but when I wrote my own function it didn't work. I had my cell A1 notation written between single quotation marks like this 'I4', I was so frustrated that just to try I changed them for double quotation marks because I used those in my own function and it worked that way.
      So my advice is that you check that you are using the same quotation marks (either single or double) in both your original function and your onEdit one.
      I really hope you manage to make it work. Good luck

    • @jonnybolton4659
      @jonnybolton4659 Рік тому +1

      Thanks. That wasn't the issue though it was because my function was trying to access other files in the Drive. The onEdit trigger doesn't allow this to happen but you can do this with "Installable triggers", I spent all afternoon going down that rabbit hole!

    • @practicalsheets
      @practicalsheets  Рік тому +1

      Hello!
      I´m glad you figured it out on your own, and apollogies for not getting back earlier.
      You are right
      There are 2 kinds of triggers in GAS: manual and installable
      manual are the functions you write such as onEdit or onOpen
      These are great because they remain in the file if you make any copies
      However their big limitation is that they cannot connect to services (They can not send an email, creat an event, or connect to another spreadsheet)
      This is when the second type of triggers come by. These are called installable triggers. As its name suggests, you need to install them on the "Triggers" menu in your GAS Editor. When you install them or create them they will sak for the permission, thus you won´t need it again
      The bad part is that they only exist on that file, that means that if you ever do a copy you need to be careful because the triggers will be erased and you need to create them again
      Hope I shed an additional light
      Regards!

    • @jonnybolton4659
      @jonnybolton4659 Рік тому

      @@practicalsheets thanks so much! One thing I did notice was when running the sheet in two different accounts, it always accessed the _owners_ files and not the _users_ do you know of a simple fix for this?

  • @BraveHeart-ht8zf
    @BraveHeart-ht8zf Рік тому

    this Tutorial is useful

  • @air961
    @air961 Рік тому

    Thanks!

  • @med1607
    @med1607 Рік тому +1

    Thank you so much for your video. It didnt work for me. I'm not sure why. My desktop buttons work but I cannot get the script to work for the edit you made. Any thoughts? I would love to share with you the code I am using. I cannot find any information on how to get it to work any where else. Your video was the closest thing I've found.

    • @practicalsheets
      @practicalsheets  Рік тому

      Did you manage?
      Regards!

    • @jonnybolton4659
      @jonnybolton4659 Рік тому +2

      I also have the same issue, the checkbox worked with the counter function, but then when I use my own function it doesn't work, even though the button (and keyboard shortcut) both work

    • @jeanaimegakwerere8591
      @jeanaimegakwerere8591 Рік тому

      Did you get an answer for that?

    • @jonnybolton4659
      @jonnybolton4659 Рік тому

      @@jeanaimegakwerere8591 yeah. See my other comment

  • @puthdarakim1175
    @puthdarakim1175 Рік тому

    Very good,

  • @gilmargilmar865
    @gilmargilmar865 Рік тому +1

    Procuro algo assim para menu de navegação. Alguém já desenvolveu algo ?.

    • @practicalsheets
      @practicalsheets  Рік тому +1

      I don´t think it is possible to do a menu in Mobile, but I may be wrong
      Regards!

  • @DwayneBrewster-p5v
    @DwayneBrewster-p5v Рік тому

    Can you create a video of how to use this button with your video “WORKOUT LOGGER GOOGLE SHEET”

  • @harunyldz5763
    @harunyldz5763 Рік тому +1

    How about a function that access another file in drive? This code doesn’t work for me.

    • @practicalsheets
      @practicalsheets  Рік тому

      For this type of function you need to have an "installable" trigger
      onEdit wont work because it needs to acces the Spreadsheet service
      These are the steps
      1. Change the name of onEdit function to any name you want, for example
      function thingsToDoOnEdit(){}
      2. In the GAS Editor, at your left go to "Triggers" (A clock icon)
      3. CLick the "Add trigger" button
      4. Choose your function
      5. On "type of event" choose "On edit"
      6. Click save
      7. enjoy
      Let me know if it works
      Regards!

  • @User-0101hsh
    @User-0101hsh Рік тому +1

    In mobile, custom dialog is still not showing up, is there a solution for that?

    • @practicalsheets
      @practicalsheets  Рік тому

      As far as I know, custom dialogs won´t work in mobile
      Regards!

  • @PromesGallery
    @PromesGallery Рік тому +1

    I need a help.can you please help me?

  • @alicenigl5862
    @alicenigl5862 7 місяців тому +1

    I don't know what is wrong with this. Within the App Scripts It works. BUT when I click on the button nothing happens. Made just the first function is working?

    • @practicalsheets
      @practicalsheets  7 місяців тому

      Double check that you included the exact name of the function without parenthesis in your button
      Kind Regards

    • @alicenigl5862
      @alicenigl5862 7 місяців тому

      @@practicalsheets REALLY very grateful for your help and knowledge. Here's what I have If copies and pastes to last row and then clears the data.
      function NRunCheckBox() {

      const ss = SpreadsheetApp.getActiveSpreadsheet();
      //Collect the Players
      const sourceSheet = ss.getSheetByName("Game");
      const sourceRange = sourceSheet.getRange ('B2:I2');
      const sourceVals = sourceRange.getValues().flat();
      const sourceSheet2 = ss.getSheetByName("Game");
      const sourceRange2 = sourceSheet2.getRange ('B12:I12');
      const sourceVals2 = sourceRange2.getValues().flat();//added
      // Append the data
      const destinationSheet = ss.getSheetByName("History");
      destinationSheet.appendRow(sourceVals);
      const destinationSheet2 = ss.getSheetByName("History");
      destinationSheet2.appendRow(sourceVals2);
      var spreadsheet = SpreadsheetApp.getActive();
      spreadsheet.getRange('B2:I11').activate();
      spreadsheet.setCurrentCell(spreadsheet.getRange('I11'));
      spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
      };
      function onEdit () {
      let activeCell = SpreadsheetApp.getActiveSpreadsheet ().getActiveCell()
      let reference = activeCell.getA1Notation()
      let sheetName = activeCell.getSheet().getName()
      let activeValue = activeCell.getValue()
      if (reference == "D20" && sheetName == "Game" && activeValue
      == true) {
      NRunCheckBox() ;
      activeCell. setValue(false);
      }
      }

    • @alicenigl5862
      @alicenigl5862 7 місяців тому +1

      @@practicalsheets I found something interesting. So the script works with the button but not the checkbox. The checkbox is actually executing the previous script I had. Even though I gave the button a different name and am using the same name as the button in the onedit statement.

    • @alicenigl5862
      @alicenigl5862 7 місяців тому

      I GOT IT WORKING!! Yay thank you again. I had saved it as a macro and that was the problem. Changed it to a script. Now all I need is to get the date to append to the data range line.

    • @practicalsheets
      @practicalsheets  7 місяців тому

      @@alicenigl5862 Hello!
      Do you by any chance have 2 onedits?
      Regards!

  • @SuportoVc
    @SuportoVc 5 місяців тому +1

    +1 sub

  • @ramakrishnapillai9722
    @ramakrishnapillai9722 4 місяці тому +1

    ഐ dontknow how to make buton plesehelp me

    • @practicalsheets
      @practicalsheets  3 місяці тому

      Just insert any image "over the cells" and now you have a button
      Kind Regards

  • @med1607
    @med1607 Рік тому +2

    I basically used the same code used here: ua-cam.com/video/ZKYvrD-3Ksc/v-deo.html

  • @Nezahual
    @Nezahual 3 місяці тому +1

    That IS NOT a button but a checkbox. What a clickbait.

    • @practicalsheets
      @practicalsheets  3 місяці тому

      Sorry if you thought it was a mislead. Is the closest to a button you'll be able to do in mobile in Sheets
      Kind Regards

    • @Nezahual
      @Nezahual 3 місяці тому +1

      @@practicalsheets of course, but the title can be "Create a checkbox that works like a button" for example, that's legit. Otherwise it's clickbait.

    • @practicalsheets
      @practicalsheets  3 місяці тому

      @@Nezahual Duly noted. Thank you for the feedback. Kind Regards!

  • @pramodmaratha5519
    @pramodmaratha5519 9 місяців тому +1

    Hi
    I have used app script for buttons...which can be used for operations from google sheet app in android mobiles.
    but I came to conclusion that unless we keep open that sheet in web version in any browser any app script doesn't run...
    that mean app script needs at least one web view login through any browser to be in function....

    • @practicalsheets
      @practicalsheets  5 місяців тому +1

      Hello!
      Nice comment!
      As a rule of thumb, I try to avoid Google Sheets in cell phone, and prefer to use AppSheet or build a webapp
      Kind Regards