Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Video Transcript
<div>0:01 Hi, so this is one of those things where Learn how to filter data effectively using the WHERE clause in your queries. Opens in new tab you have sort Discover how to sort your data in Google Sheets for better organization. Opens in new tab of like a fever dream or like a 2am sort Discover how to sort your data in Google Sheets for better organization. Opens in new tab of nightmare and you think, is that possible?<br>0:10 So I built a self-destructing Google Sheet now. What are the uses of this? This might be actually be useful but I sort Discover how to sort your data in Google Sheets for better organization. Opens in new tab of took a interesting angle on it and I was like, if you're trying to quit and you're like, I want these Google Sheets to go with me, you might be able to sell to self-destruct your <br>0:30 Google Sheets in 24 hours or a week.
I also I don't condone that kind of behavior but there might be some other actual use cases for a self-destructing Google Sheet.<br>0:42 Maybe you do have some time sensitive projects and you're like, absolutely know that I need to, you know, quote-unquote destroy or delete these sheets at x point in time.<br>0:58 Maybe it's a month after some event, 30 days after some event, or where Learn how to filter data effectively using the WHERE clause in your queries. Opens in new tab the event is not like you need to save this information.<br>1:08 Alright, enough of that. Let's see what this is, right? Let's see how it works.
So I made a little menu up here set for 24 hours from now or a week from now.<br>1:19 But what does it actually do? And does this actually work? So let's go to Extensions, Apps Script Explore Google Apps Script to automate tasks and enhance your Sheets. Opens in new tab and look at what's going on.<br>1:25 We can self-destruct this if we want. The code for self-destruct is actually pretty much, pretty much one line. It's set trashed.<br>1:35 It gets the sheet ID Understand the importance of the Sheet ID in Google Sheets. Opens in new tab here. Of the drive app, but the sheet ID Understand the importance of the Sheet ID in Google Sheets. Opens in new tab that you're in now, and it sets it to trashed.<br>1:45 True. Let me, actually let me show you. You can choose this self-destruct file. Function Get to know functions in Google Sheets and how to use them. Opens in new tab up here.
We're gonna just choose self-destruct here.<br>1:59 Click on run. And then if we go over, once it actually reviews the permissions, right, we have to do this all the time.<br>2:07 Whenever we're using Apps Script Explore Google Apps Script to automate tasks and enhance your Sheets. Opens in new tab and we need to use Drive app, spreadsheet Learn the basics of spreadsheets and how to navigate them. Opens in new tab app, whatever, we do have to authorize it.<br>2:13 And now we go over and the file is in the trash. Immediately, right? So that's set to trash, gets trashed.<br>2:20 So now in 30 days it'll permanently be deleted, but let's actually take it out of the trash.
So, how do we create a trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab that does this, right?<br>2:33 Maybe you don't wanna come into Apps Script Explore Google Apps Script to automate tasks and enhance your Sheets. Opens in new tab and hit run and self-destruct and say, okay, let someone take it out of trash.<br>2:40 So what we do is we, create another function Get to know functions in Google Sheets and how to use them. Opens in new tab called set self-destruct. And again, this is a very simple Apps Script Explore Google Apps Script to automate tasks and enhance your Sheets. Opens in new tab here.<br>2:49 Script app, new trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab , and we trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab the function Get to know functions in Google Sheets and how to use them. Opens in new tab self-destruct right here. We just, new trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab , we do that.
We call it it's a time-based trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab .<br>3:00 We have to do this little calculation Understand calculations in Google Sheets and how to perform them. Opens in new tab which is 24 times 60, times 60 times 1,000 milliseconds to know, okay, in 24 hours this trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab will run.<br>3:13 So that's what that after. Time-based means it'll run once at its particular time after x number Learn about number formatting and functions in Google Sheets. Opens in new tab of milliseconds it will run.<br>3:21 And then just create that trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab . That's all that function Get to know functions in Google Sheets and how to use them. Opens in new tab is. So we're taking a self-destructing function Get to know functions in Google Sheets and how to use them. Opens in new tab that sets it to trashed.<br>3:29 We are now creating a new trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab . That's going to self-destruct it in 24 hours.
That's what this 24 times 60 times 60 times 1000 is.<br>3:36 That's a 24 hours of milliseconds. But in addition to that I also added an unopened menu or a custom menu Create custom menus in Google Sheets for easier access to functions. Opens in new tab here.<br>3:46 And so we have to use the function Get to know functions in Google Sheets and how to use them. Opens in new tab on open in order to do that. And we set the variable ui, spreadsheet Learn the basics of spreadsheets and how to navigate them. Opens in new tab , dot get ui.<br>3:53 We create a menu called self-destruct. We add two items which are the self-set self-destruct that we already created. And then one week.<br>4:02 I create another one where Learn how to filter data effectively using the WHERE clause in your queries. Opens in new tab I just multiply that by seven.
So, I explained a little bit of why you might want to create this, again, it's a bit silly to create a self-destructing Google Sheet, but you might actually have a real use case if you're a BetterSheets member, you're watching this right now on<br>4:17 BetterSheets.co. Feel free if you know you're like, hey, I needed this in this particular instance, email me. Let me know when you actually needed a self-destructing Google Sheet and now you have one.<br>4:29 But let me talk about a little bit of things you can do to improve this, right?
You can set this trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab to sort Discover how to sort your data in Google Sheets for better organization. Opens in new tab of any amount of time.<br>4:39 You could also set this function Get to know functions in Google Sheets and how to use them. Opens in new tab to run not based on a, not necessarily user interaction, but rather different user actions, right?<br>4:50 There's a button. You can create an image Discover how to insert and manipulate images in your Google Sheets. Opens in new tab on here, assign the script as a button instead of having to say self destruct.<br>4:57 And maybe it's not called self destruct. Maybe it's called destroying 24 hours or destroying one week. And again, this is not necessarily actually destroying it in 24 hours.<br>5:07 It is setting it to trash, which then will be permanently deleted 30 days after.
So a little bit different. You might run into issues with that if you're trying to destroy the sheet right away.<br>5:21 Some other things you like to do do in order to sort Discover how to sort your data in Google Sheets for better organization. Opens in new tab of similarly create a self-destructing sheet. If you're like, hey, yeah, in 24 hours, I want to do something, then yeah, do this trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab .<br>5:32 And that trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab could trigger Find out how to set up triggers in Google Sheets for automation. Opens in new tab any function Get to know functions in Google Sheets and how to use them. Opens in new tab . The function Get to know functions in Google Sheets and how to use them. Opens in new tab could be, hey, destroy one sheet in the sheet file.
Or it could mean clear content Learn how to clear content in Google Sheets without deleting the sheet. Opens in new tab .<br>5:42 So one of the questions I had when I did release this, I sort Discover how to sort your data in Google Sheets for better organization. Opens in new tab of released this on Twitter, the code, but there is a clear content Learn how to clear content in Google Sheets without deleting the sheet. Opens in new tab function Get to know functions in Google Sheets and how to use them. Opens in new tab here you can do where Learn how to filter data effectively using the WHERE clause in your queries. Opens in new tab you don't necessarily have to delete the entire file and you don't have to delete the sheet you can just clear the content so maybe you have<br>6:05 a template Explore templates in Google Sheets to streamline your workflow. Opens in new tab that you're like hey I fill out this template Explore templates in Google Sheets to streamline your workflow. Opens in new tab I fill out this information and then a month later I literally have to delete all of this content all of the text and repopulate it and so this clear content Learn how to clear content in Google Sheets without deleting the sheet. Opens in new tab might be much better for a quote-unquote self-destructing cheat that you might want to<br>6:23 use and that you can just slip right into here instead of set trashed you say hey set this file to clear content of this particular sheet now if you're watching this and you're like hey this app script is pretty crazy I want to do more stuff like this check out spreadsheet automation 101 here on BetterSheets.co<br>6:40 and get coding you will be able to read this app script really really easily thanks bye Thank you.https://docs.google.com/spreadsheets/d/16p15fU2BwgIWlCf5MTysgUOn-tWthO_679xNZtDX_vc/edit?usp=sharing</div>