Google Apps Script Tutorial: Send Yourself an Email with the onEdit() Trigger

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

КОМЕНТАРІ • 60

  • @marksawesomeadventures
    @marksawesomeadventures 2 роки тому +2

    What I liked about this is that you didn't talk about a bunch of fluf before getting to the point, you were very clear and direct in your approach, I appreciate that.

  • @FRAN-vd9rl
    @FRAN-vd9rl 2 роки тому +3

    Dear Joseph, the script works perfectly when someone (a person) manually edits the spreadsheet, however i can't make the onEdit trigger to activate when the row is added via an HTML formular (web app) that i've deployed. thank you very much for your valuable knowledge.

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

    Hello Joseph,
    I love how useful and helpful this video is but is there any way to get it all done (like sending the mail) using onChange trigger rather than onEdit.
    I would like to receive e-mail if there's a change through a formula/function.
    If so kindly let me know

  • @sopojarwo3483
    @sopojarwo3483 2 роки тому +1

    what if we have two tab sheet? how to make variable for one of that tab sheet

  • @zaymarhenriquez-sedra2720
    @zaymarhenriquez-sedra2720 Рік тому

    what if you have different sheets, and only on one of them is where this action will happen?

  • @ExequielSalado
    @ExequielSalado 2 роки тому +1

    hello @joseph, the script will send only to one (1) user, my question is, is there anyway that i can send the email TO at least 6 emails (user) and CC to at least another 10 email (user) thank you for your video, yo the best

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

    Just wondering, am i able to do the inverse of this? Such as send an email via python automation script with data in the email body to update a cell in the google sheet?

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

    Hello Joseph, I made a fillup form website that is connected to my spreadsheet.
    What it does is when I (myself) put a value "New Appointment" on a cell in the 6th. column, an email will be sent on my GMail address.
    WHAT I WANT is when ANYONE (who submitted a form using my website and a value: "New Appointment" is automatically put on a cell in the 6th. column was put on, an email will be sent on my GMail address.
    Please tell me what should I change/do. Thank you.

  • @rockingraghav499
    @rockingraghav499 2 роки тому

    The trigger emails sent based on condition met are in loop. The emails are not sent separately. Please advise.

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

    If I have a colleague that triggers the edit, therefore they would be the active user, is there a way for the email to come from the active user instead of me? Or is it set that it will only be sent from the person who created the script?

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

    this was really useful, thank you for creating it

  • @CrimsonRed1990
    @CrimsonRed1990 9 місяців тому

    Hello Sir, Can I make a request? Can you make the triggers based on expired date? Thanks...

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

    Can you create a time-driven trigger to send emails? I tried using your code using time-driven trigger but it fails becuse of the e.range

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

    do you have to add the gmail api under services? I have similar code but dont receive an email. did all the normal troubleshooting.

  • @PendulumMotion-o6u
    @PendulumMotion-o6u Рік тому

    hello sir how to add multiple receiver email

  • @loganoakley5267
    @loganoakley5267 2 роки тому

    In line 5, it's saying that range is not being used in the actual call. What is your reasoning for including that line?

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

    Hello Joseph,
    Can we update many google sheets using only one google sheet's app script? If yes then how?

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

    Dear Jospeh,
    Would it be possible to do this but with a pdf attachment? Thanks

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

    This is great, but I want the trigger a specific email address in each line when I make a change to a dropdown status. For example, I have form data to reserve a bus and I need to let the person requesting the bus know I reserved a bus for them. I can’t find anywhere on how to do this.

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

      This is easy to do with if statements specifying, either the column in which the event takes place, or the value of the event variable. It is very common to have emails go to specific people based on different types of events. Happy to provide more information if needed.

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

    THANK YOU SO MUCH FOR YOUR VIDEO!
    It was extremely helpful!

  • @MaggieMadole
    @MaggieMadole 2 роки тому

    Hi Joseph, thank you for this! When I run my script it all works according to plan, however the execution log shows "Timed Out" in one row, as well as "Completed" in the next row. Do you know why? Is this a problem?

  • @NOUARIMOHAMED
    @NOUARIMOHAMED 2 роки тому

    Thank you.
    Can you please show us how to upload images and text from sheet to Facebook or Twitter automatically.
    Thanks

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

    is there a way to combine the content in two rows to create the project name?

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

    Hey Joseph, I’m getting the error: “Exception: The parameters ((class, String, String) don’t match the method signature for MailApp.sendEmail.” Because I’m trying to reference another a cell to grab an email located in the spreadsheet (coming from forms). Is there a different script I should be using to perform this?

  • @ShamaKhanam-zh5pq
    @ShamaKhanam-zh5pq 2 роки тому

    Hi Joseph, thanks for this.
    I have replicated the same for my sheet but the problem is, even if I update the cell value corresponding to the column where I have mentioned delayed, it triggers an email to the respondent. Any suggestions?

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

    I have a doubt i need to clarify can we connect is there any possibility?

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

    Great!
    Love this. Thank you!

  • @timon5612
    @timon5612 2 роки тому

    Thanks Joseph! I want to add some more text to the body in the mail and tried just adding it in quotation marks + the variables I want to insert but I get prompted an "missing ) after argument" error. Do you have a quick fix for this?

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому

      Hi Timon, sounds like you have at least value or parameter out of order. Your best bet is to follow the documentation for sendEmail here - developers.google.com/apps-script/reference/mail/mail-app#sendEmail(String,String,String,Object)

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

    What to do if I tag someone from contacts in the spreadsheet and I want them to receive email with the assigned task details if the task is delayed. Thankyou in advance.

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

      Hey Gunjan, I think you've given me a new idea for a video!!!
      This one can be a little tricky since there are a few ways to do it. I would recommend looking up calendar or time triggers in the Apps Script documentation. But this topic is on my list of future videos.
      Also, if this is for a work project, you're welcome to reach out to me about enlisting my consulting company to help do any kind of automation or implementation for you.

  • @adamnipperess910
    @adamnipperess910 2 роки тому

    Thank you for sharing this script but I couldn't get the message box to appear

  • @tiffanybyrd8485
    @tiffanybyrd8485 2 роки тому

    This is a fantastic video! Is there a way to have this script run for copies of my original spreadsheet? Is this related to the answer you gave below to create a project and use deploy?
    For reference, when I create a copy, it alerts me it is going to copy the App Script for the copied file, but it does not seem to work.

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому

      Hi Tiffany, thanks for the comment and question. If you make a copy of the original spreadsheet it will retain the app script in the background. However, you will need to run it manually at least once to ensure that it has permissions to continue running.

    • @tiffanybyrd8485
      @tiffanybyrd8485 2 роки тому

      @@jsphpalumbo Thank you for the response. At first that didn't work, but then I realized that apparently triggers do not copy over, so I had to recreate that part and it worked.

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому +2

      @@tiffanybyrd8485 Good call out! Yes, I guess you would have to create a new trigger. Great job, Tiffany!! You taught me something new, thanks!

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

    how would i change this to a specific cell and value

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

      Hi Boyd, the easy answer to your question is to define both the cell and value in your script, but can you give me a little more information as to what you want to do?

  • @thangnguyen-cb2dl
    @thangnguyen-cb2dl Рік тому

    Hi Joseph, it works when I directly input/type Keyword like you did.
    But when I use a function like =IF(D8 > 100, "Delayed", "In time") to au-to generate the keyword "Delayed" based on a condition -> then it's not working anymore, although that cell still shows the value as "Delayed".
    Any suggestions?
    Thank you so much.

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

      Hey thangnguyen, that's right, I'm using an "onEdit" trigger which means the email is triggered only when a cell is edited. Sounds like you might want to use a calendar or time-driven trigger where every day it reviews specific ranges and if a cell/range matches a value, it will trigger an email.

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

      @@jsphpalumbo Hi Joseph, I had the same issue as thangngyen. I changed the trigger to time (every minute). I get a failure email every time the trigger executes stating that "cannot read properties of undefined..." the same error you see when you run the script. Any suggestions?

  • @diockman718
    @diockman718 2 роки тому

    I have to send bulk emails but I just found out it appscript has 50 emails per day limit. How can I fix it? I appreciate your reply, thank you

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому

      Hi Diock, Google imposes a limit of 100 email recipients per day using Apps Script for free accounts. If you upgrade to paid Google Workspaces account that quota is raised to 1,500 per day.

  • @brunotapia9394
    @brunotapia9394 2 роки тому

    Hi joseph, im have an answer for onEdit function, every time im try to use it, it doesnt work, i dont know why, im using the same code but am editing the sheet and it just doesnt work, i cant find the answer can u help me?

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому

      Hi Bruno, you might have forgotten to set a trigger for the onEdit() function. Please watch the video again starting at 10:10 where I explain how to define the trigger.

    • @brunotapia9394
      @brunotapia9394 2 роки тому

      @@jsphpalumbo Thanks for the answer Joseph but the problem its before, the first test of onEdit with the message it is work doesnt work ahahha, but i try it in another sheet without anything and it works, just doesnt work in the first sheet with anothers funtions

  • @jamesfay8015
    @jamesfay8015 2 роки тому

    Thanks Joseph, is there a way to trigger an email when an edit matches a cell in a list on a different tab? I am attempting to create a log for students to type their name in column1 (population of 500 students), I have a list of 50-60 students that will periodically change on a separate tab. Is it possible that when one of those 50-60 students names are entered on my main sheet in column1 that it triggers an email for me?

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому

      Hi James, the easiest way to accomplish this is to put all the names you want to check against into an array, which can either be done manually in the code editor or pulled from values in a column.
      From there, you can use the array.indexOf function to see if another value is present in that array.
      So it would look something like this:
      var names = ["John", "Tom", "Mary", "Susie"];
      if ( names.indexOf(nameToBeChecked) > 0) { send email }
      It's difficult to provide a clear explanation in a comment, but I'll try to do a video example of how to work with Arrays very soon.

  • @mada20000
    @mada20000 2 роки тому

    Thank you.
    I can run it for one sheet,how can it use for
    another?
    Deploy?

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому

      You can create a project and use deploy. I tend to keep a Github repository of my most used code which allows me to quickly search for the function I need then copy/paste into a new sheet. Not the most elegant, but it's been the easiest way for me to manage and track when I update and make changes to a script.

    • @mada20000
      @mada20000 2 роки тому

      @@jsphpalumbo Thank you!Another problem is when the sheet is edit by webhook, onedit() can't trigger。。。。

  • @nurulnadia4054
    @nurulnadia4054 2 роки тому

    hi, how to solve the cannot read property "range"

    • @jsphpalumbo
      @jsphpalumbo  2 роки тому +1

      Hi Nurul. Thanks for your comment.
      That error means that getting range from the event object e failed.
      If you are running the code from inside the script editor, you will get a range error. In the case of a simple onEdit() trigger, you can only test the code by actually editing a cell. The e event variable will not have anything assigned to it unless you actually edit a cell. That e variable will be assigned an event object when the event (a cell edit) happens.

    • @nurulnadia4054
      @nurulnadia4054 2 роки тому

      @@jsphpalumbo okie thanks joseph! have a nice day

  • @nvinproperties
    @nvinproperties 9 місяців тому

    thanks

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

    how to publish this app to other people man ?

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

      Check out the Deployment feature for Google Apps Script - developers.google.com/apps-script/concepts/deployments
      Covering deployment of Apps Script is on my list of videos to make, so make sure you're subscribed!