Тёмный

How to use the onEdit(e) Function on Google Sheets 

Code With Curt
Подписаться 16 тыс.
Просмотров 81 тыс.
50% 1

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 73   
@burhansrengat
@burhansrengat 3 года назад
Excellent example,Thank you ......from Blitar Indonesia
@sergiobatista5265
@sergiobatista5265 3 года назад
Exactly was I needed. Thank you, Curt.
@trimaisonvn5078
@trimaisonvn5078 2 года назад
YOU SAVE MY AFTERNOON, THANK YOU SO MUCH !
@jasonchaplin1997
@jasonchaplin1997 3 года назад
Thanks Curt. This was a great help!
@gatorpred
@gatorpred 2 года назад
Thanks men! Simple and effective explenation :)
@DAVIDGUALDRON
@DAVIDGUALDRON 2 года назад
Excellent tutorial. Thanks.
@aaronh920
@aaronh920 3 года назад
It's GENIUS. Thanks
@leonlim1625
@leonlim1625 4 года назад
Hi Curt, thanks for the tutorial but when i run the script, i receive the error "TypeError: Cannot read property 'range' of undefined", any idea how to resolve this error? thanks
@CodeWithCurt
@CodeWithCurt 4 года назад
That is the error you will get if you try to run it in Script Editor. You need to run it by changing the cell on google sheets. The cell in my example to change is A1.
@taransaini6124
@taransaini6124 3 года назад
Nice example 💯👍
@ArBon747
@ArBon747 4 года назад
Hi Curt, excellent video, what would be the script if I want to trigger a filter in a ranking spreadsheet
@AtiqZabinski
@AtiqZabinski 3 года назад
Nice concise video. Thank you for putting the code in the comments; was easy to adapt to my project and works like a charm. I have a question, and I wonder if you might know the answer: It appears that once you create such a trigger, even though it may be only triggered by changes in one cell on one Tab, your sheet is now alerted to observe changes anywhere in all Tabs of the spreadsheet (just as a simple Trigger would), and for each change evaluate whether it passes the condition in the clause, here written as if(sheetName == 'ONEDIT' && column == 1 && row == 1) Doesn't that slow down your sheet's performance, especially if your sheet has many Tabs or the Tabs have many cells? To be on the safe side, I'm now going to split what started as a single Sheet into two, keep the Sheet with the onEdit(e) trigger minimal, and put the other Tabs, which will get deep and change often, in the other Sheet. Do you think this a wise move, or unnecessary?
@DanielEscasa
@DanielEscasa 2 года назад
`e.source` returns “Spreadsheet”. Could be a change in the API. `e.source.getName()` *does* return the name of the spreadsheet
@panjimustaqiem9013
@panjimustaqiem9013 3 года назад
Hi, Curt. Thanks for the video. How to do it with the column below?For A:1 to A:10 with output C1:C10?
@rendraridhohaqiqi9226
@rendraridhohaqiqi9226 Год назад
thanks for the tutorial, how do you move to another worksheet?
@davidburt7138
@davidburt7138 2 года назад
How would I be able to copy the information to a different cell based on a checkbox? Or better yet, how to input data in prededermined cells when the checkbox is UNCHECKED vs. a different set of predetermined cells when the checkbox is CHECKED?
@skonegardencity4784
@skonegardencity4784 4 года назад
Hi, I am just wondering why do I getting error "TypeError: Cannot read property 'range' of undefined (line 3, file "Code")"?
@skonegardencity4784
@skonegardencity4784 4 года назад
was it due to V8 runtime?
@CodeWithCurt
@CodeWithCurt 4 года назад
Did you get this error after updating the cell?
@sangvuvan8951
@sangvuvan8951 2 года назад
@@CodeWithCurt me too, nothing happened after updating the cell. This error happen while running in Script
@vikashkumarsoni8990
@vikashkumarsoni8990 4 года назад
I copied the exact code, but its not working. I do have one more onEdit function in my program. What might be the possible reason and how to solve this problem?
@CodeWithCurt
@CodeWithCurt 4 года назад
Is there any error messages? I haven't ran a script with 2 onEdit's function in it so I am not sure if that is causing the issue.
@JoseAlferezGranada
@JoseAlferezGranada Год назад
Thanks!
@Romariowll
@Romariowll 5 месяцев назад
There a way to get cell value automatic to a specific cell ?
@FabioCampedelli
@FabioCampedelli 3 года назад
Hi Curt! this is very interesting! I don't know why it doesn't work on my google spreadsheet even without giving me any error. Also, what I'm trying to do is to replace a cell on a Google Sheet anytime I edit any cell on a different Google Sheet, do you think that's possible? thank you so much, I hope you can help me with this :)
@eelamtamils5981
@eelamtamils5981 2 года назад
I got the same did you fix it? do we need any other configration?
@avisekhbanerjee8516
@avisekhbanerjee8516 Год назад
appscript does not open in mobile or tab view. no solution found till now...
@fergonzalezpy
@fergonzalezpy 3 года назад
Thanks for Sharing! Question: is it possible to trigger a script that read a csv via url and populate a sheet with data from the csv and use a cell value as the trigger?
@ddynamic0007
@ddynamic0007 3 года назад
Nice Tutorial. I am trying to create a pop up with a message giving instructions to the user that information must be entered in another cell to avoid an error. Example if I am referencing a number from another cell to a specific cell to do a division, but a number is not put into the referenced cell, I get a #DIV/0 error. I would like when that error is detected, a message pops up and reminds the user that they need to put a value in the referred cell. Thanks.
@ChrisPeter-k2r
@ChrisPeter-k2r 11 месяцев назад
is there a way to replace the if(sheetName == ) with something that could work for any sheet?
@rohitkumawat6416
@rohitkumawat6416 Год назад
Sir, how can I call an onEdit() function in a google sheet's app script ...if onEdit is already defined in an app script library.....? When I call any other function using library it is working but onEdit is not working....
@3BoxCreation
@3BoxCreation 2 года назад
Great ♥️♥️
@virtualservicosmg
@virtualservicosmg 3 месяца назад
Hello! How to column width auto on edit?
@findingidentity
@findingidentity 2 года назад
Is there a way to send the latest changes in the sheet to the email using scripts along with the data which is newly added to the sheet?
@melvinbk
@melvinbk 2 месяца назад
thanks
@noob9inz457
@noob9inz457 4 года назад
I am getting this message: "TypeError: Cannot read property 'range' of undefined (line 4, file "Code")". Can't figure out why. Any possible solution sir? Thank you.
@CodeWithCurt
@CodeWithCurt 3 года назад
Do you get this error when updating cell A1?
@noob9inz457
@noob9inz457 3 года назад
@@CodeWithCurt Yes sir. I have done exactly what you have shown.
@pichit.raetai
@pichit.raetai 4 года назад
Thank you
@jheanbueno9241
@jheanbueno9241 4 года назад
Hi Curt, I am getting an error. Can someone help me? I just copied and paste it. TypeError: Cannot read property 'range' of undefined (line 3, file "Code") Dismiss
@CodeWithCurt
@CodeWithCurt 4 года назад
Do you get this error when changing Cell A1?
@alanfidelino4141
@alanfidelino4141 3 года назад
Hi Curt. Thanks but this doesn't work for me. I even copied the code, as I thought I didn't quite get the logic.
@hanhvo4380
@hanhvo4380 3 года назад
Could help me a apps scrip to copy content of a row from many sheets when changing cell C to value "invalid" to sheet "Target". Thank you so much.
@beyondgames-lp2bz
@beyondgames-lp2bz Год назад
want to auto lock cell after data or value had been entered the whole work book or the sheet
@yelinnaing6259
@yelinnaing6259 4 года назад
Hi Curt, I would like to know how to code to get user email when edit a cell. Thanks so much.
@AntonioSantos-ve6zv
@AntonioSantos-ve6zv 3 года назад
Hi. You may have found out how already, but wth? var user = session.getEffectiveuser().getEmail() :)
@OFWdatabase
@OFWdatabase 3 года назад
How hard is it to change to onSelectionChange(e) // instead of onEdit(e)
@smuralichinna
@smuralichinna 4 года назад
Hello Curt! Thanks for the tutorial. I have run the code by changing the A1 cell value but i am getting the error TypeError: Cannot read property 'range' of undefined at onEdit. how to resolve this error? thanks in advance.
@CodeWithCurt
@CodeWithCurt 4 года назад
Is that error showing up on the google sheet after you change cell A1? In a red Box on top?
@smuralichinna
@smuralichinna 4 года назад
@@CodeWithCurt thank you reply. Yes after changing my the text in cell A1.
@yusbaculinarygourmet8272
@yusbaculinarygourmet8272 3 года назад
Cam this function runs on iphone ios... I did once its runs good on android but not iphone..
@default_youtube_profile
@default_youtube_profile 3 года назад
How to cal python script from gscript on cell edit to pull data from different source and update ni sheet ?
@RonIbarra
@RonIbarra 2 года назад
Is there a way to omit one of the tabs?
@jacobreynolds1805
@jacobreynolds1805 4 года назад
Is there an edit I can make to this that would place the data in the next available column in the row? Say, if C1 was used already, on the next edit it goes to D1?
@CodeWithCurt
@CodeWithCurt 4 года назад
I hope this answers your question. You can do a while loop to check the next available 'Blank' column in a row. Then from there you can populate it. var sheet1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('SHEETNAME'); var column = 1; while( sheet1.getRange(ENTERROW,column).isBlank() == false) { column = column + 1; } Logger.log(column);
@bizofbiz
@bizofbiz 4 года назад
Hi Curt, Thanks for your video. I get the error “SyntaxError: Invalid or unexpected token (line 10, file “Code.gs). In my code line 10 is if(sheetName == ‘ONEDIT’ && column == 1 && row == 1) Do you have any suggestions? Many thanks! Tim }
@CodeWithCurt
@CodeWithCurt 4 года назад
Try manually typing the single quotes around ONEDIT. Sometimes when you copy the code in it copies in the wrong single quote format.
@bizofbiz
@bizofbiz 4 года назад
Thanks for your help Curt!
@cabbagesoup3735
@cabbagesoup3735 3 года назад
Hello. Can you please explain what the e.range property exactly does? Thank you.
@CodeWithCurt
@CodeWithCurt 3 года назад
'e' is the object returning from the triggered event. One of the classes of the object is 'range'. Which in a google sheet could be like 'A1:B2' as an example. In the video, I am using the range to get row and column in which the trigger event happened.
@cabbagesoup3735
@cabbagesoup3735 3 года назад
@@CodeWithCurt I see! Thank you so much!
@slobodanzaric208
@slobodanzaric208 3 года назад
Hello how to put more column if i change it column == 6 with column == 6, 5, 7 its not take just on that columns its take effect on all cells
@CodeWithCurt
@CodeWithCurt 3 года назад
column >= 5 && column
@ms.breese8157
@ms.breese8157 4 года назад
Hello, Here is the code that I have made to run this onEdit. I am trying to populate one cell, not the entire column. What would I change in the code in order to have only one cell say the date the whole sheet was modified? I tried to switch 4 with the specific cell 'D4', but that didn't work. Thank you! function onEdit(e) { var row = e.range.getRow(); var col = e.range.getColumn(); if(col === 3 && row > 3 &&e.source.getActiveSheet().getName() ==="Smith" ){ e.source.getActiveSheet().getRange(row,4).setValue(new Date()); } }
@CodeWithCurt
@CodeWithCurt 4 года назад
This populates 1 cell. It would just populate D4. e.source.getActiveSheet().getRange('D4').setValue(new Date());
@MPT458
@MPT458 4 года назад
Hi Curt, will this work to setvalue to another spreadsheet?
@CodeWithCurt
@CodeWithCurt 4 года назад
I believe it will. I you watch my Copy Multiple Spreadsheets video I have a segment of code that sets the spreadsheet then I can set the value.
@sowmiyar222
@sowmiyar222 3 года назад
How to lock the cell using functions
@mijuvlogs0216
@mijuvlogs0216 3 года назад
Hi where can i contact you?
@onlineadmissionform3001
@onlineadmissionform3001 3 года назад
give the code
@justinebaldwin7889
@justinebaldwin7889 3 года назад
I'd like to combine what you created for the ClockIn/ClockOut (ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OBxnzb3_yM4.html) and this OnEdit....so that those using a mobile device can have the same experience that those using a browser get using the buttons. I'm a beginner, so I'm trying to do all of this by copying and pasting in script. Any suggestions?
Далее
Create a Button that works in mobile in Google Sheets
13:38
🎙Пою РЕТРО Песни💃
3:05:57
Просмотров 1,3 млн
Google Sheets: onEdit Basics
10:56
Просмотров 20 тыс.
Running Multiple onEdit events
14:44
Просмотров 9 тыс.
How to VLOOKUP in Google Sheets with Apps Script?
17:16
Google Apps Script Triggers Explained 👈🏽
14:32
Просмотров 32 тыс.
Google Apps Script On Edit to Specific Cell
10:48
Просмотров 28 тыс.