How To Send Emails as PDF to Kindle, Automatically

Learn how to automatically send emails as PDFs to your Kindle using Google Sheets and App Script in this comprehensive tutorial. Follow along as we set up the process step-by-step, ensuring you can read your favorite emails on your Kindle effortlessly.

You can see here I have some emails from Seth. This is a Seth Godin blog that I get every day, and I wanna read it in my Kindle. I can see over in my Kindle that I have this consumer's outnumber producers and the baled to Ginny. How did I do this? I'm gonna show you in this video, there are a few steps you have to do outside of this video to set it up, but we're actually using a blank Google sheet and app script . I'm gonna show you every line of app script you need to write. I'm gonna explain what you need to do, but first I wanna explain that you do need to be able to send an email to your Kindle. So what you're gonna need to set this up. Is you need to send it to your username@kindle.com with convert as the subject line,

and you need to ensure that you are sending email, the email that you send with, so I'm logged in with a particular email here. And I actually have no acco. This is not like a workspace thing. This is just@atgmail.com email. This is a regular email that I got years ago, just my regular email, not a business email, not business starter or anything, but that your email that you're sending from is approved in your Amazon personal document settings. I won't go into that in this video, but I need you to make sure that you're doing that because if you send emails to this address from an from an email that's not approved, it's not gonna work.

So even if you watch me do this for mine and you try to send to me, it's not gonna work. So we're gonna call his function , send email to Kindle and one. Interesting point I want to point out is that we're gonna be able to do it right here, right now, like we're gonna click run, but I'm also gonna be able to show you how we can trigger this every day at a certain time. So watch for that at the end. So we have con sender equals now this is. Who sends the emails for these particular Seth Godin emails that I get? This is a blog I get every day, or if, if you're trying to get substack in or anything like that, there's a particular email that it's sent from. So you can see here, notify@sethgodin.com. That's where they're sending all of my these emails from. And you can do a search in your Gmail, not in app script , but

you can just do a search from. Colon notify@sethgodin.com and see, does that work? If this search works and you get though all of the emails you want into your Kindle, then this is go, this AppStream is gonna work. Second thing I wanna make sure you do is that you create a label . So you go over to the left side, you click a plus sign, create new label . I've created a label called Sent Seth to Kindle. What this means is that I'm gonna search for all of these from, and I'm also gonna add minus label . Sent Seth to Kendall and now you saw the ones that are labeled don't exist here in this search. So we're gonna create this search in our app script . Go back to our app script . Let's put the sender here of who is sending the emails to us. notify@sethgodin.com.

Our Kindle email. Again, this is gonna be different for you. This is mine, but not yours. You're just gonna type in your Kindle email there. Also, we're gonna need that label , so these are just variables that we can set ourselves. You can say, sent to Kindle sent, or just Kindle. Your label doesn't. Have to be mine. It can be unique to what you want. Then we're gonna let a label equal Gmail app dot get user label by name, and we're gonna put that label name here as a variable here. So then we're gonna get all of the threads and. This is the email. This is what's called emails in Gmail. There are threads and every part of a thread is a message. So like there's a thread and then the very, if you only have one email in the thread, that's the first message.

This is equal to Gmail app. That's search. And we are gonna put in back ticks. Uh, they're above the tab button on a Mac. Why I'm doing that? 'cause I'm gonna add interpolation here. I'm gonna do question mark curly brackets and put the sender, whoever's sending it to me. Then I'm gonna do minus label , and again, I'm gonna do quote and interpolation, which is dollar sign , curly brackets. I'm gonna put the label name here. And then we're gonna do comma zero comma one. So we only want max one. The first message here, this is getting, all this is doing. The search that we did over here is pretty cool 'cause we can do that in Gmail. You may need to create the service over here on the left side.

Plus add service and get Gmail API add. Okay, let's keep going. Now we're gonna say if threads link, meaning how many messages are in there is equal to zero, how many threads are in that search result? If it's zero, we're just gonna logger log, no emails found, and we will. Return. So what this means is actually I need to put on a new line. This means if we don't return anything, stop, we're done. But if we do return something, we're not gonna stop. We're gonna keep going. So let me add some more lines here. So, so let's get the first message or the, which is Ks thread equals threads. With a square bracket and a zero, and then the message of is gonna be thread.

Do get messages and then we're gonna pop this dot pop just gets that first one. Boom. Let give it to us. And the subject of the email is message dot. Get subject with parentheses, const body is equal to message. Get body with parentheses. Now we need to create html. So one little thing that is happening, and of course we're basically getting the text inside of that message, and we are gonna need to. End up with a PDF . So how Kindle send email to Kindle works is we attach a PDF and then it shows up. I've used this for a lot of things, like when I download a PDF from the web and I'm like, oh, I want to get it on my Kindle.

I'll just attach it, send it to this email address. We need to create that PD. So that's what we're gonna be doing here, but we need to create a little bit of an HTML here, which is very, very, very simple. With back ticks, we're going to just do HTML and then end that HTML and inside of that, do a body and then end that body slash body. So make sure you have all that. And then interpolate, do dollar sign and curly brackets and just put the body in there. So what that means is we're just creating, sort of wrapping this text with HTML, whatever that email is. Now we're gonna need to create a blob. This is, uh, what they call sort of these packages of information. We're gonna create new blob and it's our HTML, and we're gonna

do in quotes, text slash html. For New Blob and get As, oh, we're gonna say application slash pdf . We're gonna set the name and that's going to be, we're gonna just use subject. You can create sort of a unique one here, or not a unique one. If you want to add a little bit of extra information, we're just gonna do subject and then add in quotes, pdf . So let me show you that on a new line there. So it's just utilities, new Blob GI as a PDF set or application slash pdf . And then set the name something, something pdf f. In our case, we're gonna use that subject because every time Seth Godin sends us an email that subject Seth Blog, is it Sciatica, the Book of Concern. That's a good title. Okay, now we wanna email it to ourselves.

Mail app or not, sorry, not email it to us. Usually I'm emailing something to myself from sheets. This time I'm emailing it to Kindle. But we're gonna do send email and we're going to need in curly brackets, a bunch of stuff. So mail, app dot, send email usually is fairly simple, like just who it's to. The subject and body and send it. But we wanna add an attachment. So we want to use these curly brackets to add some interesting little bits and pieces. So we can do two and we'll say to the Kindle email, comma subject, and our subject of the email needs to be convert. This is something from Kindle. I don't know if this actually is needed anymore. When I originally started doing this years and years ago, I did have

to have this subject as convert. I just keep it up now, not sure if it really matters. Our body actually is gonna be just a space, so colon quotes done, and then we do attachments and our attachment is in a square bracket, our blob. So our cons here, or variable blob up here is gonna be in a square bracket. That's very, very much needed name. And this is just who is sending it. Um. Not super needed. You can put a name here anywhere you want. It could be any text here. Okay. This is all to just send the attachment as a PDF , this sort of blob that we're creating as A PDF . Send that. Okay, well, once we send it, we want to add this label , so we'll go back

and do Thread, which is our original thread up here, thread's zero. Third dot add label , and it'll be our label name. Actually, it will be just the label , not label name, but label , sorry. It has to be this Gmail app dot get user label by name. We are getting the name from the name. We get the label . We apply the label here with this label. Very key n thread move to archive. So you could delete this thread if you wanted to. I like to move to archive just as I test these things out. And let's just log something like, uh, send, we can do this in, in, uh, this is just a nice little thing to do. Scent subject. To Kindle.

Okay, save this. So I am saving all of this. You can save it as a send to Kindle or an Untitled project. That name doesn't matter. I'm gonna run, I'm gonna send. This function , send email to Kindle. If I have any errors, if I have any issues, it's gonna show up. Now, if I've, uh, not done parentheses or after something, if I have a bad log, if I have a bad, like get messages isn't capitalized, I'll find that out now instead of automating it right off the bat. So I'm gonna click run and see. The very first time I ever run this, I'm gonna need to authorize it. Go to advance, go to un unsafe. Sure, select all . Continue. So it told me right here, sent Seth's blog, the right sort of friction.

And I can see that. That's the top one here. So I'm gonna refresh. Actually, I'm gonna take off this label . I don't want the minus label . I want to see all Notify at Seth Godin. And yes, the right sort of affection has this label can even probably see in ascent. There's the convert here it is sent zero minutes ago, and let's check our Kindle. So I need to go over to More and Sync. And this may take a minute. Actually, sorry. There is one weird step, which is that I have to go into my inbox. There will be an email that says verify or send to Kindle document request. The key here is that you can click within 48 hours. So I don't have to do this exactly at the moment that I.

Do it. I can do it any time within the next 48 hours. After doing this, I just have to click verify request. This is one of those weird things that Amazon takes into account your security. If you aren't getting this, um, you just have to do this. If you wanna skip this verification, you may need to edit one or more of your AL email address by visiting your preferences and manage your content and physics. So let's verify that. Request verified. Let's go check our Kindle, and it might take a minute or two. Again, we're looking for the right sort of friction in our Kindle. And there it is within two minutes. The right sort of friction. There it is in my Kindle. I can read it. This one's very small, very short as are Mo Seth emails Very cool that I can though, um, send this to my Kindle, have it available to me.

And all I need to do is write this app script . If you want to get this app script , I will make it. I will make it available in the description below, but also if you're into all of this kind of app script , check out my Udemy course KO slash. Courses. I have a course called Spreadsheet automation 1 0 1 that teaches you all of these little bits and pieces of app script and how to code. And even if you use AI to code chat GPT to code, you may need to edit that code. You may want to, uh, fix them things. AI is not perfect. It's not perfectly doing every little bit and bit and piece. And you may wanna know something like using this interpolation, or you may wanna know how to edit those strings of text that Chachi PT is creating for you.

For example, this HTML body, if I put this through, if I ask AI to do something like this, it will create a much more different HTML. It won't be very sp very, very concise, which is actually good. Sometimes you may want to change this. But sometimes you don't. You just wanna get it done. Hope you enjoyed that. Sending email to Kindle and to those who wanna automate, just go over to the left side. Triggers on the bottom right, add trigger . Which function to run, choose the function you want to run. In this particular case, there's only one function . So in this dropdown menu, there's only one function here. Send email to Kindle. I'll do that. Select event source is gonna be time driven, not from spreadsheet . And then we can change this to a Daytimer, which means we pick an hour. So, uh, I think these are sent around between five and 6:00

PM 5:45 PM 5:43 PM Yeah, so. I can say, okay, by 7:00 PM they're there. So I will say, every day, 7:00 PM to 8:00 PM do this. So click save, and now I have a trigger that will trigger that particular one and it'll only do one. Um, again, go through my course to do more. If you wanna do four loops, if you wanna do all of them, send them all at once, or all that are available kind of thing. Maybe you get more than one email a day and you want them on Kindle. But if you wanna delete that trigger and you're like, I don't want this on Kindle anymore. Go over the left side triggers. In your app script , you have a trigger here. It might have any particular error rate from 0% to a hundred percent. You can edit the time. If you're like, oh, I need to fix the time, click, edit trigger ,

and now I can change this to like, oh, I need it one hour later. Okay, save that. Or if you want to delete it, click those three buttons on the right side and click delete, trigger , delete forever. There you go. That's how you can make a trigger , delete a trigger . And send emails to, uh, your Kindle. Pretty cool, right? 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.