No video

Auto-Add Date and Time to an Adjacent Cell Upon Edit in Google Sheets with Apps Script

  Рет қаралды 10,323

Yagisanatode -Scott-

Yagisanatode -Scott-

Күн бұрын

In this tutorial, you'll learn how to automatically add a date to an adjacent cell in a Google Sheet when it is edited with a little Google Apps Script magic.
This is an incredibly useful script to add date-time stamp cells to actions that occur in your Google Sheets.
This video tutorial covers the basic process, but there are a large number of variations to this that I have collected over the years and added to the written tutorial.
To the written tutorial: yagisanatode.c...
** More on OnEdit() **
- Add an email onEdit() (For domain workspace accounts): • Add an Editor's Email ...
- Google Apps Script: Create a Select All Checkbox to Tick Checkboxes in Any Desired Range in Google Sheets: yagisanatode.c...
** My Site **
yagisanatode.com/
** More on Google Apps Script **
yagisanatode.c...
** Products **
Create and Publish Google Workspace Add-ons with Google Apps Script: Master Class yagisanatode.c...
* Courses *
yagisanatode.c...
* Google Workspace Tools *
yagisanatode.c...
* Google Workspace Add-ons *
yagisanatode.c...
#googleworkspace #googleappsscript #googledrive #googlesheets #mp4 #videoediting #admin #businessadministration @googleworkspacedevs ​

Пікірлер: 47
@yagisanatode
@yagisanatode 10 ай бұрын
NOTE! If you try and run the onEdit(e) function from the Apps Script IDE you will get an error saying that you "Cannot read properties of undefined (reading 'range') onEdit". This is because the function can only read the event ("e") parameter when it is generated as a simple trigger in the Google Sheet. Go ahead and make an edit in the sheet at the assigned locations an then come back and see the results in the log. You can learn more about this in the written version of the tutorial found here: yagisanatode.com/add-the-current-date-to-a-sheet-when-data-is-added-so-that-the-date-does-not-changestatic-google-sheets/
@luisc1402
@luisc1402 16 күн бұрын
Is it to early on our relationship to say I love you? Thanks a lot for this video! Running (or trying to) a board game library in our small town. Don't know how to manage databases, so just making a lending system to keep track of stuff with google sheets. I wanted to make it as simple to users as possible. So, now they don't even need to fill in the date! Thanks a lot for the video!
@yagisanatode
@yagisanatode 15 күн бұрын
Awh shucks. Great usecase! My wife and I are board game fans too. We have our regular board game day tomorrow at our local game cafe.
@pumba1267
@pumba1267 10 ай бұрын
Very useful lesson and explained in a very very simple way that as a beginner helped me immensely.
@yagisanatode
@yagisanatode 10 ай бұрын
Fantastic to hear.
@FernandoFischer6048
@FernandoFischer6048 Ай бұрын
I do not know you but I love you Brother, thank you very much!
@AmmarMerhbi77
@AmmarMerhbi77 Жыл бұрын
Thank you so much... I was looking for this script.
@yagisanatode
@yagisanatode Жыл бұрын
You're welcome
@temyraverdana6421
@temyraverdana6421 Жыл бұрын
Thanks a lot, a very useful lesson
@yagisanatode
@yagisanatode Жыл бұрын
Glad you liked it!
@philiphopkins8827
@philiphopkins8827 4 ай бұрын
I have several sheets on which I would like to run this code to add the date. I've tried removing the lines that check the sheet tab but it will not run. Is there a way to amend this to run on any sheet in the workbook? Thanks.
@yagisanatode
@yagisanatode 4 ай бұрын
Sure, check out the expanded written tutorial in the link in the description of the video.
@DisciplineBeatsMotivation8053
@DisciplineBeatsMotivation8053 9 ай бұрын
perfect job sir, i wonder if i could does this with cells changing values in the first sheet but making time stamps in the second sheet?
@yagisanatode
@yagisanatode 9 ай бұрын
Absolutely!
@derejebizualem2112
@derejebizualem2112 6 ай бұрын
Thank you.
@yagisanatode
@yagisanatode 6 ай бұрын
You're welcome!
@kiralyszabolcsingatlan
@kiralyszabolcsingatlan 2 ай бұрын
Hello! If we want to use the same code on several tabs within a file, how to change "const SHEET_TAB_NAME ="? THX
@yagisanatode
@yagisanatode 2 ай бұрын
Have a look at the written version of this tutorial for a heap of variations. Link in the description of the video.
@jaroooddd
@jaroooddd Ай бұрын
This is just what i needed! I do however have a small problem. I have a script that copies specific cells in sheet 1 and pastes them in sheet 2 for data entry and data recording, however when the script runs and pastes the values in their cells, the onedit script doesn't run, even though the correct cell has been edited. Is there a way to make this function react to a script pasting the information, rather than user input?
@yagisanatode
@yagisanatode 24 күн бұрын
I would append the script and add the date to that. As you have found, onEdit() requires user interaction. Hope this helps.
@user-oq7lm3lr8t
@user-oq7lm3lr8t Жыл бұрын
it's really help full me, Thank You.
@yagisanatode
@yagisanatode Жыл бұрын
Glad to hear that
@user-ll2zc2fq4j
@user-ll2zc2fq4j 8 ай бұрын
Very helpful thanks a lot. How i can use it for more than one sheet?
@golammostofa9255
@golammostofa9255 2 ай бұрын
I was looking for it. But where can i get this code?
@yagisanatode
@yagisanatode 2 ай бұрын
Link to the written tutorial in the description.
@AmmarMerhbi77
@AmmarMerhbi77 Жыл бұрын
Does it work if column uses query or importrange from different sheet?
@yagisanatode
@yagisanatode Жыл бұрын
No. Unfortunately this is not considered an onEdit condition. Clock Triggers may be your friend here.
@barryrodgers
@barryrodgers 9 ай бұрын
Hi. Thank for this. I have a sheet where data is added in using Zapier. The time and date doesn't appear when the data is added, only if the data is edited. Is there a fix for this please?
@iamdeepakchawla
@iamdeepakchawla 4 ай бұрын
What If I want the Date on the column entry instead of column Edit. Like one column is blank and someone from my team has added the Ticket ID to the column, so I want the date to be printed in another column. What should I use instead of "function onEdit(e)"
@yagisanatode
@yagisanatode 4 ай бұрын
The onEdit function is a special simple trigger function used in Google Apps Script. To change columns for the input and the triggered response, update the variables to the new locations. Check out the written tutorial in the link in the description.
@user-om7zr6rf8f
@user-om7zr6rf8f 7 ай бұрын
is there any way for the script to only enter date and not the time?
@yagisanatode
@yagisanatode 6 ай бұрын
Sure, you can use either set the formatting in the Google Sheet to only show the date. Format - Number - Date. Or you can use the JavaScript toLocaleDateString() method on the new date. developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString Hope this helps.
@SierraofTerra
@SierraofTerra 7 ай бұрын
is there a way to modify the script to add a timestamp when another cell's formula changes its result? I.e i have a cell that sums up a series of other cells and I'm trying to have that summed cell be the trigger that adds the time stamp. thank you 🙏 edit: i tried to create a "onChange" trigger in the triggers tab but it appears i have much to learn as i got an error that says: TypeError: Cannot read properties of undefined (reading 'getSheet') at onChange(Code:7:30) 😅
@yagisanatode
@yagisanatode 7 ай бұрын
Hey there! As you have discovered, the onEdit() simple trigger function requires a user edit of a cell. You could trigger onEdit when the source cell has been modified and then have the code look at your formula cells each time, and if they meet your required parameters, add the date-time stamp. This is usually the common practice here. Alternatively, you could set a short clock trigger if you don't require any immediate changes or include a button for the user to submit for the change. Clock Triggers: developers.google.com/apps-script/reference/script/clock-trigger-builder
@jugbrewer
@jugbrewer 10 ай бұрын
When I try to run this I'm getting this error: "Cannot read properties of undefined (reading 'range') onEdit" Any idea why this might be happening? I've entered the code exactly as you have presented it
@yagisanatode
@yagisanatode 10 ай бұрын
If you are running from the Apps Script UI , you will get an error because there is no event ("e") parameter for the script to read. Try running the script as intended from the onEdit trigger insise the Google Sheet. If the error persists, please let me know. I'll pin a comment about his for others.
@rockwithkunal
@rockwithkunal 9 ай бұрын
Hey , Please let me know how to solve this issue. I cant understand just by reading ur text, can you please make a video on how to deal with this error ? please?@@yagisanatode
@ScottDonald78
@ScottDonald78 9 ай бұрын
​@rockwithkunal you can find more details in the written version of the tutorial via the link in the description.
@rockwithkunal
@rockwithkunal 9 ай бұрын
@ScottDonald78 yeah I hv checked that as well still facing same error. can u please make video on that ?? please
@OfficialJohnnyNelson
@OfficialJohnnyNelson 11 ай бұрын
Why not just use the formula =IFS(B2="","",A2"",A2,1*1,NOW()) and then drag and auto-fill the rest of column A?
@yagisanatode
@yagisanatode 11 ай бұрын
The date will adjust dynamically, usually after the edit on any cell on the sheet. The Apps Script solution proposed is a static change. You can also use the shortcuts: - ctrl + ; for date - ctrl + shift + ; for time - ctrl + shift + alt + ; for date and time. The benefit of a programmatic solution here is that it removes a step that the user needs to take. You can learn more here: yagisanatode.com/add-the-current-date-to-a-sheet-when-data-is-added-so-that-the-date-does-not-changestatic-google-sheets/
@iliaskyvos953
@iliaskyvos953 10 ай бұрын
​@@yagisanatodeis this going to work even if I change a color of the cell?
@yagisanatode
@yagisanatode 10 ай бұрын
@@iliaskyvos953 Test it to see if a manual colour change is an onEdit() event. You can learn more about this script's capabilities in the link in the description.
@Mohammed-gy2rc
@Mohammed-gy2rc 8 ай бұрын
Thanks a lot very helpful. How can i use it for more than one sheet?
@yagisanatode
@yagisanatode 8 ай бұрын
Do you mean sheet tab or spreadsheet file? For another tab, check out the written version of this tutorial found in the description. For a separate spreadsheet, either copy and paste in the code, duplicate the current sheet or make a template with the script bound to it.
@Mohammed-gy2rc
@Mohammed-gy2rc 8 ай бұрын
@@yagisanatode I mean for more than one spreadsheet in the same workbook
@yagisanatode
@yagisanatode 8 ай бұрын
@@Mohammed-gy2rc yagisanatode.com/add-the-current-date-to-a-sheet-when-data-is-added-so-that-the-date-does-not-changestatic-google-sheets/#Inserting_the_automatic_date-time_stamp_updater_into_multiple_sheet_tabs
Google Sheets - Add Timestamp When Cell Changes - Apps Script
16:39
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 335 М.
How to know who and when edited my Google Sheet
13:48
Practical Sheets
Рет қаралды 11 М.
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 3,2 МЛН
КТО ЛЮБИТ ГРИБЫ?? #shorts
00:24
Паша Осадчий
Рет қаралды 1,4 МЛН
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 37 МЛН
How To Timestamp Cells In Google Sheets
8:48
Think Stocks
Рет қаралды 100 М.
Google Apps Script On Edit to Specific Cell
10:48
The Excel Cave
Рет қаралды 27 М.
Collect form submissions in Google Sheets with Fillout
2:52
Google Apps Script: Copy Rows To A New Sheet Based on Cell Value
25:48
Automatically Sort Data in Google Sheets
13:23
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 138 М.
Automatic Last Updated Timestamp in Google Sheets - Apps Script
7:05
How to VLOOKUP in Google Sheets with Apps Script?
17:16
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 38 М.
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН