Time Based Trigger - Apps Script | Script Service ~ Episode 3.1

  Рет қаралды 18,454

David Weiss

David Weiss

Күн бұрын

Пікірлер: 35
@davemacdonald7910
@davemacdonald7910 3 жыл бұрын
Learning for the first time and these videos are extremely helpful! Thanks so much for this!
@DavidWeissProgramming
@DavidWeissProgramming 3 жыл бұрын
You're very welcome! Glad you like them!
@nsikakumoh1883
@nsikakumoh1883 3 жыл бұрын
Thank you so so much David. As an Apps Script enthusiast, I really love this video.
@edgarzh
@edgarzh 2 жыл бұрын
Really thank you to make and share these videos. It's extremely helps!
@noob9inz457
@noob9inz457 3 жыл бұрын
You are a gem brother. Take love.
@henryramos8392
@henryramos8392 Жыл бұрын
Thanks for the informacion, friend
@kingjoshuamanatad1402
@kingjoshuamanatad1402 3 жыл бұрын
Awesome content!
@gsheetssolutions
@gsheetssolutions 2 жыл бұрын
Hey David, how do I stopped if have a script triggers daily creating a copy of template and I want it it stopped at the end of the month. How do i do this with codes?
@EthanPatrick-k4w
@EthanPatrick-k4w 4 ай бұрын
Theoretically, could I set up a daily time based trigger in the Triggers UI to run between 12AM-1AM for the setUpTrigger function and use the at() method to specify a specific time by modifying new Date() when I run it at midnight? Get new Date, then modify so it happens on a specific time of that date. This would allow me to do basically the same thing as atHour().nearMinute() without the 15 minute +/-
@EthanPatrick-k4w
@EthanPatrick-k4w 4 ай бұрын
something like this: function createTrigger() { var now = new Date(); // Convert the current time to Pacific Time var convertPacific = now.toLocaleString('en-US', { timeZone: 'America/Los_Angeles' }); // Create a new Date object with the Pacific Time var pacificNow = new Date(convertPacific); // Set the time to 4:00 PM var runtime = new Date(pacificNow.setHours(16, 0, 0, 0)); // 16:00:00.000 is 4:00 PM Logger.log(now); Logger.log(runtime); // Create the trigger to run at 4 PM Pacific Time ScriptApp.newTrigger('closeSnoozed') .timeBased() .at(runtime) .create(); }
@satyajit2019
@satyajit2019 Жыл бұрын
I want to send reminder each and every day Monday to Friday On a specific time Can you please create the video for me.
@TheEnlightened
@TheEnlightened 3 жыл бұрын
Hi, what if my function recieves a e.response.getRespondentEmail(), which I want to save and use for all of my triggers, how do I save the email I got from the google forms trigger and use it for all future triggers I create which are basically tons of autoresponders of emails for the same respondent? The newTrigger() function recieves no variables I think... which is why its not working for me. I would apperciate your advice on this matter, thanks.
@DavidWeissProgramming
@DavidWeissProgramming 3 жыл бұрын
Hm, interesting! If I understand correctly, you are trying to save a Form respondent's email address and create a trigger such that the function (such as sending an email) only fires for that email address. Okay, yes, you are correct. The newTrigger() function receives no variables, so you'll have to store this respondent's email another way. If I were addressing the problem, I would either save the respondent's email in either Properties Service by using the method PropertiesService.getScriptProperties().setProperty(emailAdress, message) (See Season 12 kzbin.info/www/bejne/r4PcfoBoq5V0a8U for more info on how), or in a Spreadsheet somewhere. Then I would set up one trigger that called one function which would loop through all the email addresses in the Spreadsheet and send a personalized message for each one. The personalized messages as well as any other data you wanted to store could be included alongside the email address in the Spreadsheet too! Hopefully this explanation helped? Let me know if you're still unclear on anything!
@TheEnlightened
@TheEnlightened 3 жыл бұрын
@@DavidWeissProgramming Thanks for helping. I did exactly that but the problem is that it saves only one mail in the PropertiesService var, which means that if two people opt in at the same time, it creates problems as the trigger hasnt been called/finished properly and so all emails wouldnt be sent to the initial respondent but only to the ultimate one. Thoughts on how to deal with this situation? It is very urgent as I have tried solving this for the longest time. Thanks
@ZabuArts
@ZabuArts 2 жыл бұрын
Thank you very much!
@FRAN-vd9rl
@FRAN-vd9rl 3 жыл бұрын
hi David, your channel is pure wisdom! one question i was wondering, i think i've been using time based triggers but just by clicking the clock button, there is also the clock button in the new IDE of the google editor. Is that the same? i haven't found in the clock options the option to run a script after X miliseconds of a previously run script.
@MsElegant01
@MsElegant01 3 жыл бұрын
Is it possible to create time based alert inside time based alert. Eg. 1st alert at specific time every day triggering every 5m trigger? Here 5m trigger will run main function.
@DavidWeissProgramming
@DavidWeissProgramming 3 жыл бұрын
Hi Vidya! Absolutely! You can create and run triggers that set up other triggers to run. I did a demonstration similar to this in my "Exact Time Trigger" Episode: kzbin.info/www/bejne/jKDFZ4SvZZZglbs Check it out! :)
@MsElegant01
@MsElegant01 3 жыл бұрын
@@DavidWeissProgramming Hi thanks alot for reply. I tried this code but second trigger is getting disabled even before executing main function. I have similar code with little bit different logic but in that code too second trigger is getting disabled before execution. Can u pls guide me where am I going wrong? Or Google changed its trigger system? I am struggling with the code since a week. :-(
@angelsano4513
@angelsano4513 2 жыл бұрын
How do I automate the running of the trigger?
@jerickalegarbes6906
@jerickalegarbes6906 3 жыл бұрын
do time-based triggers only run while the spreadsheet is open? I'm new to this.
@DavidWeissProgramming
@DavidWeissProgramming 3 жыл бұрын
Hi Jerick. Nope! Time-based triggers run regardless of whether spreadsheet is open or not. That means it will run even if you close the browser, power off your laptop and store it away.
@adityanalwaya6065
@adityanalwaya6065 3 жыл бұрын
Hi I want to send automatically google form to myself every day at specific time on my Email address can I do it???
@peterfrost250
@peterfrost250 3 жыл бұрын
I have a page with 2-3 triggers updating 10-20 items by MINUTE. But...I seem to be limited by Google. Is there a limit to riggers/refreshed to a google sheet? 90 minutes a day?
@ms.breese8157
@ms.breese8157 4 жыл бұрын
Hello, Could you walk me through how I could set up a Timebase Trigger for clearing parts of my table? I am trying to set up an attendance sheet and I would like the column in my table to be cleared at midnight every day. I have multiple sheets that I need this for. Thank you!
@DavidWeissProgramming
@DavidWeissProgramming 4 жыл бұрын
Hello Ms. Breese! That should be easy. You'll need to set up two functions for this. The first will set up your time based trigger to run once a day at midnight. The second will be the function it calls which actually clears the column from the Sheet. In this second function you'll need the url of the Sheet (or if you have multiple Sheets, you'll need all of the urls). Then connect to the Sheet in Apps Script via SpreadsheetApp. Get the worksheet name and range and then use the method clear(). Additionally, you'll need to manually run the function clearAttendanceSheet() just once before setting up the trigger in order to authorize SpreadsheetApp to operate on your behalf. Below is an example of how it would work for just one Sheet. If you have multiple Sheets, just repeat the same logic for all of them. function createNewTrigger() { ScriptApp.newTrigger('clearAttendanceSheet') .timeBased() .everyDays(1) .atHour(0) .create(); } function clearAttendanceSheet() { const spreadsheet = SpreadsheetApp.openByUrl('docs.google.com/spreadsheets/d/1Q85vRQFzTfzaW-jSTNMx7D0Mny-loPXUxnWcXBNlIlw/edit#gid=0'); const sheet = spreadsheet.getSheetByName('Sheet1'); sheet.getRange('A:A').clear(); }
@raktimasensarma82
@raktimasensarma82 4 жыл бұрын
I made a script to entry some data in a google form, and set to trigger it continuously every after 5 mins. Actually it is my school attendance form. So it is closed all the day but in a certain time it opens and I want after a successful submit these script will stop for a few hours and will start again according to my trigger. If you could help me with these I would be really grateful to you. Thanks!
@ruairidhgrass3479
@ruairidhgrass3479 3 жыл бұрын
I get TypeError: ScriptApp.newTrigger(...).timeBased.after is not a function any idea whats going on?
@DavidWeissProgramming
@DavidWeissProgramming 3 жыл бұрын
Hi Ruairidh! It looks like the TypeError you're getting is because you're not actually calling the "timeBased" method. To call it, you have to add parentheses after the method name. Like this: .timeBased() Putting it all together, your code should look similar to this: ScriptApp.newTrigger('sendEmail').timeBased().after(10000).create(); Does that make sense? Feel free to reply if you need more help! :)
@Fernitano
@Fernitano 3 жыл бұрын
Ey! Great video! I tried but appears TypeError: Cannot read property 'getRange' of null at myFunction(Código:2:29) Could you help me? I´m would like to bring btc value, with importdata from Binance API. Thanks!
@DavidWeissProgramming
@DavidWeissProgramming 3 жыл бұрын
From the error alone, it seems that Apps Script cannot find the Sheet you are looking for, and thus returning null. "Null" has no method called getRange() and thus it is erroring out. That sounds like a fun project! I've done similar things myself. Be sure to check out my Patreon page: www.patreon.com/DavidWeissProgramming and consider becoming a platinum patron if you want help building it out :)
@feroscyp8250
@feroscyp8250 3 жыл бұрын
could i run a function every secon?
@UtkarshAgarwal
@UtkarshAgarwal 3 жыл бұрын
Thank you so much, you explained in a very easy way. I am a beginner in coding but the way you explained really helped me to clear all my doubts and i was able to connect with your process at one go. Amazing video. I have a question too, if i have 2 functions written on a single script, then how can i merge those two and run this time trigger for both of them at the same time?
@kbtmukhil9254
@kbtmukhil9254 3 жыл бұрын
how can send paragraphs by mail
@DavidWeissProgramming
@DavidWeissProgramming 3 жыл бұрын
Hi KBT MUKHIL! You can send paragraphs with the same exact method used in the video above! Use the method GmailApp.sendEmail(recipient, subject, body); or MailApp.sendEmail(recipient, subject, body); and replace the "body" argument with your paragraph. If you want your paragraph to be slightly more stylized and formatted, include your paragraph as HTML in the optional arguments. For example, use this: GmailApp.sendEmail(recipient, subject, body, { "html": " (add your html here) " });
Google Apps Script Triggers Explained 👈🏽
14:32
saperis
Рет қаралды 34 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 3,4 МЛН
Make an API With Google Sheets and Google Apps Script
15:53
Cukmekerb's Coding Class
Рет қаралды 64 М.
Script Authentication - Apps Script | Script Service ~ Episode 3.9
13:34
App Script Editor Tutorial - Google Sheets - Excel VBA Equivalent - Read & Write to Ranges & Cells
29:48
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 665 М.
Google Sheets - Add Timestamp When Cell Changes - Apps Script
16:39
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 341 М.
Apps Script UrlFetchApp API, Get JSON data, Build Google Sheets Function, Advanced Tutorial
47:18
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 152 М.
Google Sheets Web App Example - Google Apps Script Web App Tutorial - Part 1
31:41
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 811 М.