Google Sheets onEdit Trigger - Automatically Drag Down Formulas - Apps Script

Поделиться
HTML-код
  • Опубликовано: 4 дек 2024

Комментарии • 91

  • @lanhoyc4435
    @lanhoyc4435 5 лет назад +15

    You're the best teacher i have ever seen about googlesheet. So clever!
    Thank you

  • @Vooced
    @Vooced 5 лет назад +6

    I literally fall on my knee each time I get to see one of your new videos. Each time you make my day!

  • @delitekom3820
    @delitekom3820 4 года назад +3

    First of all thank you so much for ALL your videos, they have been a constant source of learning and all i know about google sheet is thanks to you.
    3 things
    1. We want this to work only on the formula mentioned in row 2
    2. Only update the last row on edit
    3. Copy and paste as value
    Basically what copy down addon does
    Would greatly appreciate your support
    Thanks again

    • @delitekom3820
      @delitekom3820 4 года назад

      I Think ill explain a bit more, For example we have data in 4 Columns A,B,C,D and formula in E2
      So First row of all is Title
      And data from form will come in ABCD row,
      So once the data comes
      1. the formula should copy from E2 to the last cell
      2. Paste the result as value
      Something like
      IF 4 is current last data filled row and new form is submitted
      A B C D = Data Row , E2 = formula cell
      If A5 is not null copy formula from E2 and paste on E5
      Then copy the result of E5 to E5 as values
      Hope this makes sense

  • @Puner54
    @Puner54 3 года назад +2

    It's so cool to see how you make Google Sheets do whatever you want!

  • @wellnessandskincareclinic7715
    @wellnessandskincareclinic7715 2 года назад

    This channel is the most informative I have found.

  • @aleca7011
    @aleca7011 2 года назад

    This is the script I didn’t know I needed, amazingly helpful and very well explained! Thank you so much

  • @trushitkakrecha9777
    @trushitkakrecha9777 5 лет назад +1

    I was seeing your web app series ,its very useful but i am not able to do it myself without learning < html> .I hope you will make video for it

  • @AlexM-ym7kd
    @AlexM-ym7kd 3 года назад +1

    Thank you for sharing such useful content. I appreciate how you explain each step very clearly. I don't have a lot of experience with sheets, but I have some practical experience with javascript. This all made sense very well. Thanks!

  • @HoBrian
    @HoBrian Год назад

    Very details. just what i want to learn. thank you very much

  • @mfurkanakyurek
    @mfurkanakyurek 4 года назад +2

    This is amazing. Thanks for this tutorial!

  • @pavelhodosevich1151
    @pavelhodosevich1151 2 года назад

    This video is awesome, you answered all my questions, thank you very much, sir.

  • @baoquyphamvan371
    @baoquyphamvan371 3 года назад +1

    It totally work w me. I appreciate it

  • @pauldemo8061
    @pauldemo8061 5 лет назад +1

    I really enjoy your videos, awesome work. I have a question what if I only want the formula to be only copied down so that it doesn't affect any data above that is not formula dependent?

  • @jheanbueno9241
    @jheanbueno9241 4 года назад +7

    Hi, i tried this - onEdit() function part, I am receiving an error TypeError: Cannot read property 'range' of undefined (line 3, file "CLEAR")Dismiss. Care to explain why?
    function onEdit(e)
    {
    var cell = e.range;
    var activeSheet = e.source.getActiveSheet();

    • @ianpropst-campbell6028
      @ianpropst-campbell6028 4 года назад +1

      Had the same problem

    • @ali5t4ir
      @ali5t4ir 3 года назад

      I have the same error - Cannot read property 'source' of undefined - in fact I get Undefined for all e, activesheets, tab etc. - any help is appreciated

    • @clharri23
      @clharri23 3 года назад +3

      @@ali5t4ir I think it's because onEdit only runs when you make a change to the active spreadsheet. Don't press the play button in the script editor.

    • @felipetesta
      @felipetesta 2 года назад

      @@clharri23 thanks, now it worked!

  • @singhalmonica
    @singhalmonica 3 года назад

    Great tutorial. Pls make a video on how to use index and match in script editior.

  • @rendraridhohaqiqi9226
    @rendraridhohaqiqi9226 Год назад

    thanks for the tutorial, how do you move to another worksheet? did try with oneedit(e) function but failed

  • @Ryanrenata01
    @Ryanrenata01 3 года назад

    Thanks, you save my time again

  • @LDomingos-g4z
    @LDomingos-g4z Год назад

    can you please explain the difference by create custom formula for specify code and for any spreadsheet?

  • @prestigelock
    @prestigelock 4 года назад

    love it, one quick question, if I have a cell currently does not use a formula, how do I prevent that from being overwritten by this?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 года назад

      Not easy. You would have to use get formulas method and compare with get values method and then create the new array from both.

  • @mehmetaliyurtsever
    @mehmetaliyurtsever Год назад

    Thanks for sharing this content with us.
    Is there a way to get the formula before it was changed inside the cell?
    Can you advise us about this I will appreciate that?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Год назад

      e.oldValue

    • @mehmetaliyurtsever
      @mehmetaliyurtsever Год назад

      ​@@ExcelGoogleSheets Actually, I wasn't asking that. Think this way. There is a formula in a cell, and it is trying to protect from changing by the user. However, we can not use cell protection because the formula should change by script. I thought I could get the formula in the cell with the onedit function so I could paste the formula back into the cell. e.oldValue gave us cell value. Is there a possibility of getting old formula in the cell?

  • @jayasreekasinathan1161
    @jayasreekasinathan1161 2 года назад

    Hi A perfect video to understand OnEdit trigger..Can you similary explain OnFormSubmit trigger. I am trying generate a propertyID automatically for every form submission in google sheet.

  • @bollywoodbee7299
    @bollywoodbee7299 4 года назад

    Great teacher

  • @HelioCan
    @HelioCan 4 года назад

    Thank you! Its beautiful!

  • @AsadAli-jx9kf
    @AsadAli-jx9kf 2 года назад

    amazing video, but how we can do this with Vlookups?

  • @bocobox
    @bocobox 4 года назад

    I am a big fan of your vidoe. I have a question what I could do move to bottom row in sheet once it opened since it has too many rows and takes a while to drage it all the down.

  • @J-Abyss
    @J-Abyss 5 лет назад

    Hey just started watchingsome of your videos, there are very helpful when i ever hit a wall in google sheets but i was if you can make a video on creating a script that calculates the sum of a set of cell/columns but ignore all fields that have had a strikethrough applied to the vaules in the rows/columns?

  • @arawjr.flores8523
    @arawjr.flores8523 3 года назад

    Superb!!!

  • @amrbaligh7787
    @amrbaligh7787 5 лет назад

    Thanx aloooot for these vids .

  • @pichit.raetai
    @pichit.raetai 5 лет назад

    Love this channel

  • @adriangreener493
    @adriangreener493 4 года назад

    is it possible to use post requests with the onedith trigger?

  • @gothbrooks5738
    @gothbrooks5738 5 лет назад +2

    how do you get the autocomplete/suggestions in the script editor

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  5 лет назад +2

      Just have a browser that supports it and nothing is blocking it. Firefox or Google Chrome should work unless you have some sort of addon that prevents it from working.

  • @lpanebr
    @lpanebr 5 лет назад +1

    Very nice. This could be an add-on! When activated it creates an options tab where the user may just add tab names and columns.

  • @Limesh
    @Limesh 5 лет назад

    Thanks a lot for great videos. Learning along with your videos is fun and easy.
    Have one query, If I paste multiple lines (rows) onedit() function seems to be triggered only once. Can I detect all the rows that have changed?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  5 лет назад

      e.range should give you the range when you alter multiple rows. I'm not exactly sure what happens with paste, but I'd imagine it should still give you the range that was altered.

    • @umanggajjar5522
      @umanggajjar5522 4 года назад

      I am also facing same issue I am copying a multiple rows of data and onedit function is triggered only for first cell rest cell data remains unchanged

    • @umanggajjar5522
      @umanggajjar5522 4 года назад

      Can you please make video for this as well ?

  • @haihuynhthanh3078
    @haihuynhthanh3078 2 года назад

    Thanks your lesson. I have a small question: when i try to input add data into row 16; but calculation for column 6, 7, 8 don't auto display formula as well as Results. may you help me?

  • @domare_rami
    @domare_rami 3 года назад

    What if you want it to run everytime the value inside the formula changes?

  • @radeneki
    @radeneki 5 лет назад

    Is there any way to make login form google form and if login condition is correct then jump to another google form?

  • @emptygaming8738
    @emptygaming8738 4 года назад +1

    This doesn't work anymore. Constantly getting "[20-03-04 13:42:07:058 SAST] TypeError: Cannot read property 'oldValue' of undefined
    at onEdit(Code:2:44)" error

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 года назад

      You shouldn't be running the function from the script side. If you do you will get undefined.

    • @emptygaming8738
      @emptygaming8738 4 года назад +1

      @@ExcelGoogleSheets The issue was that I was viewing the "Logs" and not the "Stackdriver Logging". With V8, the "Logs" don't show anything anymore.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 года назад

      Good to know. Thanks for the update.

    • @gdanscykurierzyrowerowi4232
      @gdanscykurierzyrowerowi4232 4 года назад +1

      @@emptygaming8738 and how did you change the viewing from "Logs" to Stackdriver?

    • @ali5t4ir
      @ali5t4ir 3 года назад

      @@ExcelGoogleSheets so how else are you supposed to run it please? if it doesnt work how else do you debug?

  • @datascientist6233
    @datascientist6233 2 года назад

    If we incert a new row in between will it work that's the task I have or at the botttom new records update by fetching vlookup..
    This is somehow my requirment thank U Man God Bless You Bro..

  • @rishirishi4970
    @rishirishi4970 2 года назад

    Thanks

  • @bulbulahmed3098
    @bulbulahmed3098 10 месяцев назад

    great.

  • @paulloup5210
    @paulloup5210 5 лет назад

    Thank you very much

  • @kingjoshuamanatad2140
    @kingjoshuamanatad2140 4 года назад

    I created a timestamp in my sheet everytime when there is a "Yes" in that particular column. But what if, if the value in a column in a particular is a lookup from other folder. I tried it manually writing "Yes" and the time stamp works. I tried the lookup version, then "Yes" will appear if the condition is met but the timestamp didn't work at all. I tried using oneEdit() function but it did work manually but if it is a lookup then it will not work.

  • @giamar3026
    @giamar3026 2 года назад

    Helly Teacher, do you have a video on how to create an free app mobile from google spreadsheet? As i donn't know if is posible or do i have to pay if i need this app to share with 4 users? also i need appSheet or there is a way from appScript to fit in the mobile screen?

  • @atharmuslim
    @atharmuslim 2 года назад

    thanks man

  • @ProgrammerForever
    @ProgrammerForever 4 года назад

    1) you can write this in row 2 for autocalculate all rows:
    *=ArrayFormula(IF(A2:A="";"";B2:B+C2:C))*
    i'ts work perfectly
    2) the best solution is
    *if (tabs.indexOf(activeSheet.getName())===-1){return;};*
    instead of
    *if (tabs.indexOf(activeSheet.getName())!=-1){*
    *//your*
    *//long*
    *//code*
    *};*

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 года назад

      Thanks for your input.

    • @felipetesta
      @felipetesta 2 года назад

      There's some situations that we can't use arrayfórmula. Like when we have a index iteration inside de formula, for example (as far as I tested). The video is a solution for this indeed.

    • @ProgrammerForever
      @ProgrammerForever 2 года назад

      @@felipetesta for index iteranion use *=arrayformula(ROW(A:A))* , example *=arrayformula("index="&ROW(A:A))*

  • @anthonychung2907
    @anthonychung2907 3 года назад

    My scrip editor do not have the debug - menu bar ? why

  • @DarthVadersMum
    @DarthVadersMum 5 лет назад

    what does the 'e' refer to, I've tried copying the code exactly as you have, but the function does not work and generates error: TypeError: Cannot read property "source" from undefined. (line 2, file "Code"). Would really appreciate some help on this?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  5 лет назад

      e refers to event object. If you're not a programmer, I'd suggest follow the tutorial step by step instead of trying to copy the final code.

    • @cheewurz
      @cheewurz 4 года назад

      @@ExcelGoogleSheets ...been through the Video step-by-step 3 times and I get the Same Error.

  • @ESP95
    @ESP95 3 года назад

    I am starting with action script and google sheet. I have created functions to use, when I passed an argument to a function and it returned the value according to the input all fine, but if I use
    function name(x,y){
    Return x*y
    }
    When I run it on the sheet I get Error , I have watched videos and I can't figure out where the error is. Could you help me?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 года назад

      javascript is case sensitive. Return is not the same as return

  • @horebedward2358
    @horebedward2358 5 лет назад

    bro how can i solve the maximum execution time exceeded error?

  • @panuwatpnc8462
    @panuwatpnc8462 3 года назад

    how to get trigger from cell value change by from formula/importrange/query ; change by calculate value not change user edit

  • @zhewaling
    @zhewaling Год назад

    CB/01/2023
    CB/02/2023
    CB/03/2023 When I highlight and drag down the column, it only increases from the end but not from the centre. I want to increase from the center. Please help me.

  • @tomsawkins9828
    @tomsawkins9828 5 лет назад

    just caused myself a huge headache by not adding the below code - before this script runs
    spreadsheet.setActiveSheet(spreadsheet.getSheetByName('C&C Customer Collection Form'), true);
    spreadsheet.getRange('M3').activate();
    because it ran on the activesheet and i wasn't on the sheet i wanted, it ran the code on the wrong sheet !!
    lesson learned

  • @Thongtele
    @Thongtele 3 года назад

    please show me onedit on a new version of app script.

  • @dewaynewest7756
    @dewaynewest7756 4 года назад

    OnEdit not showing logs.. just says please wait

    • @dewaynewest7756
      @dewaynewest7756 4 года назад

      Any help?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 года назад

      @@dewaynewest7756 Logs may not always work with events like this. Just ignore and move forward.

  • @yoalfreparra3973
    @yoalfreparra3973 5 лет назад

    Its possible to copy the formula and change some text for another?
    example:
    =SUM(FILTER(Principal!$D$2:$D;MONTH(Principal!$A$2:$A)=1;YEAR(Principal!$A$2:$A)=2018;Principal!$C$2:$C="Text to change"))
    for
    =SUM(FILTER(Principal!$D$2:$D;MONTH(Principal!$A$2:$A)=1;YEAR(Principal!$A$2:$A)=2018;Principal!$C$2:$C="Other Text"))

  • @daydreamerny
    @daydreamerny 4 года назад

    first you go watch some others video then teach other ppl