Add a Button To Automate Add a Row with Date
Learn how to create a button in Google Sheets that automatically adds a new row with the current date, streamlining your data entry process.
Let's create a button to add a row and add the date automatically. Of course, we could insert row above and then put in maybe today and we get today and then we have to copy paste those values perhaps. But let's make this very simple. Going to go to extensions app script . Once there we're gonna write a function called. Add row with date here. We're going to do spreadsheet app dot get active sheet , insert row before two, so we could do after, but what's going to happen is if we insert a row after the header or the. Row one. We're going to inherit the design of the first row. We want to inherit the design of the second row, so we have to go to the second row and insert one above in app script that is insert row before.
Now we have to enter the date spreadsheet , app.gi, active sheet , get range . We're gonna go to the second row and we want to go to the third column that is here in the C column. Here we're gonna do dot set value, and inside of the parentheses we'll do new date with parentheses. We can test this out by clicking run here once we save it. And there we have a new row and the date is added. Let's automate this with a button. We're gonna insert drawing , select our shape. Let's make it. A bevel shape, add, row, save, and close. And we can click and drag this over here to the right. Can even put it right up here in the header . Now we need to assign the script. We'll go back to our app script and make sure we copy this
function name, add a row with date. We'll come and come back to our. Button in, in the upper right corner, there's three dots. A signed script we're gonna click and then copy paste just the name of the script. Click okay. And now every time I click the button, I add a row with the date. If you want to get more out of your Google sheets, just like this, and do more with your Google sheets. Subscribe to better sheets on YouTube right here, right now.