+ Reply to Thread
Results 1 to 12 of 12

Google code script convert to onEdit code

  1. #1
    Registered User
    Join Date
    11-15-2016
    Location
    South Africa
    MS-Off Ver
    2021
    Posts
    9

    Google code script convert to onEdit code

    My google code script needs to be changed to onEdit code. Changed to " function onEdt" and its not working. Try to run the script on my cell phone app. Would appreciate any help. Thanks

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 10-24-2024 at 02:15 PM.

  2. #2
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,142

    Re: Google code script convert to onEdit code

    Hi Mon Star,

    It would be much easier for us to try to help if you can:
    * provide a sample file with sample data included so that proper testing can be done, and with the apps script included.
    * give a clear detailed explanation how the script is supposed to be triggered when an edit is done (because right now its not obvious in the script)


    You can use this form to create a sample file for anonymous sharing:
    https://docs.google.com/forms/d/e/1F...UvZ_Q/viewform

    Alternatively, you can try posting to these platforms instead:
    https://groups.google.com/g/google-a...ript-community
    https://stackoverflow.com/questions/...le-apps-script
    As a gesture off appreciation, you can click * Add Reputation at the foot of any of the posts of members who helped you reach a solution.

    And finally, was your problem solved? if so, please click Thread Tools above the first post of your enquiry, then select [Solved]

  3. #3
    Registered User
    Join Date
    11-15-2016
    Location
    South Africa
    MS-Off Ver
    2021
    Posts
    9

    Re: Google code script convert to onEdit code

    Will do so. Thanks

  4. #4
    Registered User
    Join Date
    11-15-2016
    Location
    South Africa
    MS-Off Ver
    2021
    Posts
    9

    Re: Google code script convert to onEdit code

    Here is a picture
    Attachment 881660

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 10-24-2024 at 02:15 PM. Reason: please use code tags

  5. #5
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,142

    Re: Google code script convert to onEdit code

    The link to the picture seems to be invalid.

    In any case, it will but much more useful if you can provide a link to a sample file so that we aren't expected to create a file in order to help you.

    To post a link, because you have less than 10 messages in the forum, you will need to break up the link with some spaces so that it can be posted successfully.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Google code script convert to onEdit code

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however we recommend that you include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.

    I added them for you because you a new.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  7. #7
    Registered User
    Join Date
    11-15-2016
    Location
    South Africa
    MS-Off Ver
    2021
    Posts
    9

    Re: Google code script convert to onEdit code

    Last edited by 6StringJazzer; 10-24-2024 at 10:57 PM. Reason: converted to live link

  8. #8
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,142

    Re: Google code script convert to onEdit code

    For the script to work on mobile, you cannot use a button to run an apps script.

    To allow the script to run on mobile when cell A1 is edited, you should use a checkbox.

    Heres an apps script that will give the results you are looking for:

    Please Login or Register  to view this content.
    Last edited by janmorris; 10-25-2024 at 03:24 AM.

  9. #9
    Registered User
    Join Date
    11-15-2016
    Location
    South Africa
    MS-Off Ver
    2021
    Posts
    9

    Re: Google code script convert to onEdit code

    When I run the script, I get the following error: Type Error: Cannot read properties of undefined (reading 'source')

  10. #10
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,142

    Re: Google code script convert to onEdit code

    Of course.

    Running it from the apps script editor will give the error because there is no edit event captured by the script.

    You said you wanted a script to (a) run automatically when a "button" was pressed, and (b) that it must work on mobile.

    To do that requires that you use a checkbox (or some other reasonable method of validating an edit, but a checkbox is by far the easiest), and an "On edit" trigger.

  11. #11
    Registered User
    Join Date
    11-15-2016
    Location
    South Africa
    MS-Off Ver
    2021
    Posts
    9

    Re: Google code script convert to onEdit code

    Thank you. Working perfect

  12. #12
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,142

    Re: Google code script convert to onEdit code

    Great!

    As a gesture off appreciation, you can click * Add Reputation at the foot of any of the posts of members who helped you reach a solution.

    Also, please click Thread Tools above the first post of your enquiry, then select [Solved]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Exclude a specific sheet on onEdit function [Google Apps Script]
    By bhenlee in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 02-14-2023, 09:04 PM
  2. Convert VBA to Google Apps Script
    By B_H in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2021, 04:39 AM
  3. How to convert vba to google script
    By Klea in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2021, 10:53 AM
  4. Convert short VBA code to google sheet Json
    By tagazou in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2020, 07:44 AM
  5. How to convert Google Script to Excel Macro?
    By cestanton.1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2020, 05:28 PM
  6. Google Sheets onEdit Script Failing On Mobile
    By swordswinger710 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 10-11-2019, 12:21 PM
  7. Converting vba code into google spreadsheet script:dynamic dropdownlist
    By paradise2sr in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 03-05-2018, 11:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1