Audit Your Gmail

In this video, learn how to perform a simple Gmail audit using Google Sheets and App Script to analyze your email metrics, including unread messages and subject line characteristics.

This is a super simple video. This is a basic Gmail audit. I'm gonna show you a little bit of the code, but you can go and grab this in the description. I'll put a link to this in the description. This shows me how many days back I can set this. I'll show you where , how many messages I've gotten, how many Gmails I have, how many I have on average per day, and how many are unread, and are the subjects above or above under. 50 characters subjects with all caps words. I'll set some words here that I want to check if they have the subject in them, if they have the word in the subject. And I can also see a count of how many emails I get over the course of certain hours. And then you can also see the top sending domains. Now this better sheets.co. That's me. I am Better sheets.co. I actually send myself a lot of emails.

I actually send myself an email a day. It's one of the products I sell. It's called Sell Daily. Go check it out, but also check out better sheets.co just to see Cool Google Sheets like this. I'm gonna go over to Extensions app script . I'm gonna walk you through the code. So the first thing first is I go to our custom menu and I'm gonna reset this audit. And what that's doing is it's a literally on the on open, I'm just creating a menu. And this reset audit, all it's doing is deleting the sheet summary. Called summary, and when I run the Gmail audit, it's gonna create a sheet called Summary. So you can see here I have sheet, I also have Raw here. That actually is a list of all the emails. I'm not gonna show you in this video, but just trust me, it's there. So in the script, again, you can get the script in the description below, just copy the sheet and run your own audit.

We're gonna set our days back. This could be. 50, 60. I set it to 30. I wanna see how many emails I got within the past month, right? Roughly max Threads set here. I have tried this at higher threads, but I get an error that it's too much. So I set this at 500. Summary. If you want to change the name of the summary tab, change it here, also change it down here, but let's. Look at what this run Gmail audit function does First, it's gonna build a query . It's gonna go how many days back? Newer, then look for days, and it's gonna use Gmail app dot search and put that query in there. We we're gonna set a bunch of these metrics down to zero. This is just creating the first. Like total messages number at zero.

And then for every single thread we're gonna go through a certain sort of regimen and just say like, is this message after a date or is it greater than now? This total messages plus. Plus just means take the variable now and add one. So that's like a really good shorthand to have if you are just iterating a number . We're checking if it's unread. We're checking the subject and let's look at where that subject is used. It's used for the length. We're getting the first word. We're getting any all caps words. We have a function called all has all caps. We have a function that says, get first word. We can actually go and find this. Get first word. Here it is. It's just saying take the subject. Replace it, trim it, put it to lowercase, and give us the first part

Here it's testing. Does it have an emoji? Here we're taking it and testing against certain words like ai, crypto, SaaS. If you want to change these, literally just change this AI here to whatever word you want. You don't have to change. Change the uh, variable here. Like, maybe you don't want crypto, but maybe you want like circle back. So you wanna say circle. And then you're just gonna want to come down to this like 2 0 9 row, two till 2 27. And instead of mentions crypto, this is just text and you say Circle, and maybe we want C-I-R-C-L maybe without the E and just hit command S or save or. So it's pushing all of data into the raw section, and then it's gonna write this summary sheet. All of these. Variables. It's going to add them there.

And that's the end of the app script . If you want to take a deeper dive, again, just check the app script out in the description, copy it to your drive and use it so we can run this Gmail audit. And it's gonna say running script also, it's gonna have you authorize it the very first time that you run it. Just make sure you authorize it. It's not sending me any data at all. It's just running on your drive. If you do have any failures, it will say that it has a failure, but you can also check over here in app Script over on the left side executions. And we can see it's still running. This is gonna take a minute or two. Here it's done, and you can see all of the counts here. Again, just grab it down below. I hope you enjoy this Gmail audit. You are watching better sheets here on YouTube.

Make sure you check out this video or this video and subscribe right now to get more tips, tricks, how tos, get more out of your Google sheets than you ever have before. I'm excited to be making a ton more videos here. Ask me questions down in the comments and I will answer them in future videos. But for right now, right here, one of these videos is gonna be your next Google sheet.