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

  Рет қаралды 24,267

Joseph Palumbo

Joseph Palumbo

2 жыл бұрын

In this video I show you how easy it is to trigger an email to be sent when a spreadsheet is updated, even with a specific value, using Google Apps Script's onEdit function.
You can review the code I wrote in this video at github.com/palumbo/KZbin-Sc...
WANT TO SAVE MONEY USING GOOGLE WORKSPACES?
If you're interested in maximizing the capabilities of Google Workspace to help organize and run your small business, non-profit, charitable organization, or even your family, you can use my affiliate link - referworkspace.app.goo.gl/ZkK1 - along with one of my promotional codes to get 10% off of your first year!!
Business Starter Promotion LCWXMA4CWAEM6XN
Business Standard Promotion P7Y7AMGTQ64KP3V

Пікірлер: 60
@marksawesomeadventures
@marksawesomeadventures Жыл бұрын
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.
@markslagle9742
@markslagle9742 9 ай бұрын
this was really useful, thank you for creating it
@mustakim2144
@mustakim2144 Жыл бұрын
THANK YOU SO MUCH FOR YOUR VIDEO! It was extremely helpful!
@imamsibromuhlisi1520
@imamsibromuhlisi1520 Жыл бұрын
Great! Love this. Thank you!
@FRAN-vd9rl
@FRAN-vd9rl Жыл бұрын
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 Жыл бұрын
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
@nvinproperties
@nvinproperties 5 ай бұрын
thanks
@anthadupulasuresh2539
@anthadupulasuresh2539 Жыл бұрын
Thank you for making this video. But I wanna ask you something. If I want delete the specific group of cells data with the help of onedit function and one cell as trigger to run the script, what i need to write in Appscript. Please help in this regard. Thanks in advance
@ShamaKhanam-zh5pq
@ShamaKhanam-zh5pq Жыл бұрын
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?
@MaggieMadole
@MaggieMadole Жыл бұрын
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?
@mathewgarrett814
@mathewgarrett814 4 ай бұрын
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?
@sopojarwo3483
@sopojarwo3483 Жыл бұрын
what if we have two tab sheet? how to make variable for one of that tab sheet
@NOUARIMOHAMED
@NOUARIMOHAMED 2 жыл бұрын
Thank you. Can you please show us how to upload images and text from sheet to Facebook or Twitter automatically. Thanks
@zaymarhenriquez-sedra2720
@zaymarhenriquez-sedra2720 11 ай бұрын
what if you have different sheets, and only on one of them is where this action will happen?
@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?
@ExequielSalado
@ExequielSalado Жыл бұрын
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
@rockingraghav499
@rockingraghav499 Жыл бұрын
The trigger emails sent based on condition met are in loop. The emails are not sent separately. Please advise.
@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.
@loganoakley5267
@loganoakley5267 Жыл бұрын
In line 5, it's saying that range is not being used in the actual call. What is your reasoning for including that line?
@user-vf9hs5em6v
@user-vf9hs5em6v Жыл бұрын
is there a way to combine the content in two rows to create the project name?
@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
@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.
@rohitkumawat6416
@rohitkumawat6416 Жыл бұрын
Hello Joseph, Can we update many google sheets using only one google sheet's app script? If yes then how?
@user-dv7xe5ks9o
@user-dv7xe5ks9o 10 ай бұрын
hello sir how to add multiple receiver email
@rustanmanalad1952
@rustanmanalad1952 Жыл бұрын
Dear Jospeh, Would it be possible to do this but with a pdf attachment? Thanks
@CrimsonRed1990
@CrimsonRed1990 5 ай бұрын
Hello Sir, Can I make a request? Can you make the triggers based on expired date? Thanks...
@selvamkaran6749
@selvamkaran6749 Жыл бұрын
I have a doubt i need to clarify can we connect is there any possibility?
@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 Жыл бұрын
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)
@adamnipperess910
@adamnipperess910 Жыл бұрын
Thank you for sharing this script but I couldn't get the message box to appear
@jamesfay8015
@jamesfay8015 Жыл бұрын
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 Жыл бұрын
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.
@adaptableamy4744
@adaptableamy4744 8 ай бұрын
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 8 ай бұрын
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.
@tiffanybyrd8485
@tiffanybyrd8485 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@tiffanybyrd8485 Good call out! Yes, I guess you would have to create a new trigger. Great job, Tiffany!! You taught me something new, thanks!
@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?
@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.
@diockman718
@diockman718 Жыл бұрын
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 Жыл бұрын
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.
@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。。。。
@brunotapia9394
@brunotapia9394 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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
@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?
@nurulnadia4054
@nurulnadia4054 Жыл бұрын
hi, how to solve the cannot read property "range"
@jsphpalumbo
@jsphpalumbo Жыл бұрын
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 Жыл бұрын
@@jsphpalumbo okie thanks joseph! have a nice day
@sieunhanbienhinh6486
@sieunhanbienhinh6486 Жыл бұрын
how to publish this app to other people man ?
@jsphpalumbo
@jsphpalumbo 11 ай бұрын
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!
Google Apps Script Send Emails from List
17:23
The Excel Cave
Рет қаралды 4,1 М.
تجربة أغرب توصيلة شحن ضد القطع تماما
00:56
صدام العزي
Рет қаралды 52 МЛН
Nutella bro sis family Challenge 😋
00:31
Mr. Clabik
Рет қаралды 13 МЛН
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 123 МЛН
That's how money comes into our family
00:14
Mamasoboliha
Рет қаралды 11 МЛН
Google Sheets - Send Emails Using Apps Script JavaScript MailApp Tutorial - Part 12
36:10
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 244 М.
Google Sheets onEdit Timestamps, Everything about onEdit Function - Live Stream Recording
52:22
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 41 М.
How to automatically send customized mails from Gmail
25:13
Automation Made Easy
Рет қаралды 65 М.
Google Apps Script Triggers Explained 👈🏽
14:32
saperis
Рет қаралды 31 М.
Google Apps Script: Copy Rows To A New Sheet Based on Cell Value
25:48
Google Apps Script Tutorial for Beginners
23:54
saperis
Рет қаралды 367 М.
Automate emails with Google Forms and Google Apps Script
36:42
Matt Brigidi
Рет қаралды 13 М.
Running Multiple onEdit events
14:44
Spencer Farris
Рет қаралды 9 М.
Automate emails with Google Sheets
17:17
Matt Brigidi
Рет қаралды 18 М.
How to Automate Emails Through your Google Sheet
22:35
Bootstrapping Tools
Рет қаралды 26 М.
АЙФОН 20 С ФУНКЦИЕЙ ВИДЕНИЯ ОГНЯ
0:59
КиноХост
Рет қаралды 478 М.
Сколько реально стоит ПК Величайшего?
0:37
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Кинг Комп Shorts
Рет қаралды 1,8 МЛН
Красиво, но телефон жаль
0:32
Бесполезные Новости
Рет қаралды 883 М.
Cheapest gaming phone? 🤭 #miniphone #smartphone #iphone #fy
0:19
Pockify™
Рет қаралды 2,3 МЛН
Я УКРАЛ ТЕЛЕФОН В МИЛАНЕ
9:18
Игорь Линк
Рет қаралды 114 М.