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

Поділитися
Вставка
  • Опубліковано 11 гру 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.

  • @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

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

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

  • @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

  • @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!

  • @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?

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

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

  • @singhalmonica
    @singhalmonica 3 роки тому

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

  • @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?

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

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

  • @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.

  • @mfurkanakyurek
    @mfurkanakyurek 4 роки тому +2

    This is amazing. Thanks for this tutorial!

  • @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?

  • @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?

  • @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.

  • @LDomingos-g4z
    @LDomingos-g4z Рік тому

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

  • @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.

  • @baoquyphamvan371
    @baoquyphamvan371 3 роки тому +1

    It totally work w me. I appreciate it

  • @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.

  • @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..

  • @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?

  • @adriangreener493
    @adriangreener493 4 роки тому

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

  • @Ryanrenata01
    @Ryanrenata01 3 роки тому

    Thanks, you save my time again

  • @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.

  • @bollywoodbee7299
    @bollywoodbee7299 4 роки тому

    Great teacher

  • @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?

  • @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.

  • @domare_rami
    @domare_rami 4 роки тому

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

  • @AsadAli-jx9kf
    @AsadAli-jx9kf 2 роки тому

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

  • @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?

  • @HelioCan
    @HelioCan 4 роки тому

    Thank you! Its beautiful!

  • @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.

  • @pichit.raetai
    @pichit.raetai 5 років тому

    Love this channel

  • @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

  • @arawjr.flores8523
    @arawjr.flores8523 3 роки тому

    Superb!!!

  • @amrbaligh7787
    @amrbaligh7787 5 років тому

    Thanx aloooot for these vids .

  • @anthonychung2907
    @anthonychung2907 3 роки тому

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

  • @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))*

  • @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.

  • @paulloup5210
    @paulloup5210 5 років тому

    Thank you very much

  • @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

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

    thanks man

  • @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"))

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

    Thanks

  • @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

  • @bulbulahmed3098
    @bulbulahmed3098 10 місяців тому

    great.

  • @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.

  • @Thongtele
    @Thongtele 4 роки тому

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

  • @daydreamerny
    @daydreamerny 4 роки тому

    first you go watch some others video then teach other ppl