Create Google Sheets Updated Date Column

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

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

  • @CodeWithCurt
    @CodeWithCurt  3 года назад +12

    Google Apps Script Code in Video Below:
    function onEdit(e) {

    var range = e.range;
    var spreadSheet = e.source;
    var sheetName = spreadSheet.getActiveSheet().getName();
    var row = range.getRow();

    if(sheetName == 'DATA')
    {
    var new_date = new Date();
    spreadSheet.getActiveSheet().getRange(row,6).setValue(new_date).setNumberFormat("MM/dd/yyyy hh:mm:ss A/P");
    }

    }

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

      Sir.. i got error :
      TypeError: Cannot read property 'range' of undefined
      the error on var range = e.range;

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

      @@anwarbinmaranmoe9319 did you ever solve this?

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

      @@anwarbinmaranmoe9319 i also got this error

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

      it worked for my old sheet but when I started another sheet, it is giving me an error on range and I changed the sheet name already

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

      Is it possible to apply a formula instead of date ?

  • @aaronstone2155
    @aaronstone2155 2 года назад +2

    Thank you for the great script. After getting it working, I realized I had to edit the header text on the row I was writing the date in. This caused it to put the updated date instead of taking my header title. I modified the script so it checks to see if the row you are working in is 1 and if so, it just drops through. See below
    function onEdit(e) {

    var range = e.range;
    var spreadSheet = e.source;
    var sheetName = spreadSheet.getActiveSheet().getName();
    var row = range.getRow();
    if(value.row > 1);
    {
    if(sheetName == 'Data')
    {
    var new_date = new Date();
    spreadSheet.getActiveSheet().getRange(row,6).setValue(new_date).setNumberFormat("MM/dd/yyyy hh:mm:ss A/P");
    }
    }

    }
    Hope this helps someone!

    • @ThanhNguyen-bv7ol
      @ThanhNguyen-bv7ol Год назад

      when I ran debug, it says e,,range,spreadSheet, sheetName, row, new_date all are undefined.

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

      man thx alot! but for me "if(value.row > 1); "not working. I do "and" statement
      change if(sheetName == 'Data') to if(sheetName == 'Data' && row > 1)

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

    Thank you so much for sharing those helpful videos!
    How can I prevent from the colum headline (UPDATED DATE) to also change once I elite the other columns names? Thanks!

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

    Hallelujah. THANK YOU!!! Explained so simply.

  • @nooralmamoory4813
    @nooralmamoory4813 2 года назад +2

    Thanks a lot!
    One question please, what is I want to specify the range of cells/columns that I want to auto-date them
    Means I don't want to have an updated for any change in the sheet, I want it for a specific range

  • @EricDuPont-jt3hy
    @EricDuPont-jt3hy Год назад +1

    This is so freaking helpful. Thank you so much!

  • @Mary-fd8qn
    @Mary-fd8qn 3 года назад

    Very helpful!! Thank you so much. Will always be waiting for a new video tutorial from your channel :)

  • @tejraj23
    @tejraj23 Год назад +2

    can we do it for specific cell edit, instead of complete row?

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

    WORKED GREAT! Is there, by chance, a way to add a line to the code to get an email notification when a user updates the table?

  • @shivali.tiwari
    @shivali.tiwari 6 месяцев назад

    Hey Code with Curt
    Your video is really helpful and easy to understand and most importantly it WORKSSS!
    But instead of row i want it to use on the column. When the timestamp has to change when there is an change in the column
    What changes do i have to make to do that??
    Please help🙏

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

    Man you are doing grate Job. Really love your work.

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

    Good job Curt! Thanks man :)

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

    Thanks man you're a lifesaver!

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

    Hello, good tutorial. How would I make it so that the top row isn't changing? Everytime I click on the header row, it changes my "Updated Date" text to a date.. Is there a solution to this? Thanks.

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

      On the If statement change to this:
      if(sheetName == 'DATA' && row > 1)

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

    How to show “Last edited” date and user on cell value in another cell/column in Google Sheets?

  • @karthik.a1443
    @karthik.a1443 7 месяцев назад

    Hi Sir, this script not running when i shared the spreadsheet to other, and not reflecting the timestamps who are edit the cells, its working only with my mail Id only, what i do ?

  • @HappyBargain
    @HappyBargain Год назад +1

    i want the date to change only when i modify on a particular Column, what do i change in the code ?

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

    ALLAH BLESS YOU FRIEND IT'S VERY EDUCATIONAL AND OBVIOUSLY OF MY USE
    THANKS

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

    Hi guys, great function. Please can you tell me how to "copy" this function for more columns? I just want to have a date of change of each of 6 colums separately. Many thanks!

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

    Thank you so much for the script. It helps a lot to manage my team.
    Could I have the GG Sheet auto-update the Dates based on a certain column input only?

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

    Hello there, love your video...simple and to the point. I do have a question for you...using your example, when you update the miles, it timestamps, if you go back and update it again, will that overwrite the previous date? If yes, is it possible to control the date entered initially and show modified date in a separate column?

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

    Thanks for the wonderful code, I have observed 1 issue here, If we paste values in multiple cells the date is updated for only the first row. Is there any way to update all the rows?

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

    Thanks Curt!

  • @PiPuPiPu750
    @PiPuPiPu750 5 месяцев назад

    thank you for the video. do you know a way if i wanted only a cell to display the updated date whenever any cells in a given table were edited? i found a formula =IFERROR(SUM(C4:N28)+"X", TODAY()) but it display today's date even though i didn't change anything

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

    Thanks so much for the video!

  • @md.jinnah2347
    @md.jinnah2347 3 года назад +5

    Error
    TypeError: Cannot read property 'range' of undefined

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

      Hey. Did you find a fix on this? im having the same issue.

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

      @@lopezarias Change the "Date" field to the name of your sheet, and also change the number of cells in the row (I write more for the next viewers)

  • @ChrisPeter-k2r
    @ChrisPeter-k2r 11 месяцев назад

    I got this to work! Is there any way to make it work for every sheet instead of having the specific if(sheetName == ' ' ) ?

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

    I have an issue, If i made a mistake and i dont want a row updated, i cant undo and it keeps updating to today's date, How can i change so that i can just undo if i accidently update the wrong thing. BTW good video

    • @HarshKumar-or8qc
      @HarshKumar-or8qc 3 года назад

      @Code With Curt, Could you please help with the above query? Thanks in advance!

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

    Is there a way to add a timestamp for when the sheet row or column was created?

  • @BraveHeart-ht8zf
    @BraveHeart-ht8zf 9 месяцев назад

    the problem arises when input form with submit via apps script, timestamp not created. how to modify this scripts?

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

    Works great! however if i remove an entry in that row it wont let me delete the date, it'll keep reappearing

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

    THANK YOU FOR THIS VIDEO

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

    How can we find time for a specific each column wise? Can we help me to finish my project

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

    Thank you!

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

    So I want a query (not on App Script) that populates with a date time format to be reformatted with a different date time format - how do I do that?

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

    Something odd is happening for me, when I edit something in the bottom row, it updates the date on several rows above it as well.

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

    I've multiple sheets (with different number of columns)in a file in google sheet & want to have a sheet which automatically contains date & time on which every other sheets was last edited.
    how this can be done..???

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

    Is there a way to prevent it from adding the date when a new row is created?

  • @batangkalye-vn3tv
    @batangkalye-vn3tv Год назад

    i like you video and it realyful is ther a program about every sheet that channge date and then after editing can be save as pdf file?

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

    Thanks for your video, I tried to change only on a column change
    changed
    if(sheetName == 'DATA')
    with
    var column = cell.getColumn();
    if(column == 2)
    But is not working... can this be made?
    Thanks in advance

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

    is it possible to instead of date it will say "updated 1 day ago"

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

    What part of code should i modify if i want updated date populated ONLY if a specific column changed NOT ANY COLUMN
    Thank you

    • @CodeWithCurt
      @CodeWithCurt  3 года назад +6

      Example would be for column 2. Add variable:
      var column = range.getColumn();
      if(sheetName == 'DATA' && column == 2)

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

      @@CodeWithCurt Thank you so much 🙏

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

      @@CodeWithCurt Unfortunately, it's not working. Nothing happens when I change or add something in column 2.

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

      @@CodeWithCurt You're awesome! Please keep on making these great contents.

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

    With "show edit history" where does the name come from? Mine just says "All anonymous users".

  • @eazy-eye-srilanka
    @eazy-eye-srilanka 3 года назад

    Wow nice video

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

    Thank you

  • @MuhammadAli-mc2qj
    @MuhammadAli-mc2qj 2 года назад

    Ohhh thanks broo

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

    Really helpfull sir but how can I change the mm/dd/yyyy hh,mm,ss set to philippine time?
    The code was usefull but it appears that the time sets on the america

    • @sugakookie.
      @sugakookie. 2 года назад

      i believe it's based on your google account's timezone. so you'd have to change your timezone to philippines' if you want to use this unedited code

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

      For me, now: Menu "File" -> Item "Settings" -> Tab "General" -> Section "Time zone"

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

    how do i make this to many sheets?

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

    thanks

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

    What if other people on my sheet?

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

    Automatic cell lok After data entr google sheet plz tell

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

    Cannot read property 'range' of undefined (line 3, file "Code"

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

      can you help me this?

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

      @@fmcourses6293 Hey. Did you find a fix on this? im having the same issue.

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

      @@lopezarias Change the "Date" field to the name of your sheet, and also change the number of cells in the row (I write more for the next viewers)

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

      @@fmcourses6293 Change the "Date" field to the name of your sheet, and also change the number of cells in the row (I write more for the next viewers)

    • @sugakookie.
      @sugakookie. 2 года назад

      @@lopezarias I don't know why, but I finally got it to work by changing my sheet's name to something else. Make sure you change Line 8 as well.
      if(sheetName == 'NAMEHERE')
      NAMEHERE should be your Sheet's name.
      I didn't have to edit Line 3 at all. Not sure if it was just coincidence, but it finally worked for me.

  • @batangkalye-vn3tv
    @batangkalye-vn3tv Год назад

    hi

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

    Thanks man!