How Sending One SMS Message Can Back Up a Web Page to Google Drive
Whatsapp Pinterest
Advertisement

Here’s a fast way to save an article or a web page. Just SMS that URL to yourself and save the web page as a PDF file to your Google Drive account to read later.

You can set up this convenient automation yourself in just a few steps, right now! Let’s get started.

Step 1: SMS to Google Sheets With IFTTT

You don’t have to sign up for any paid service to save pages for offline reading. The first step is going to be setting up an automation so that you can SMS a URL to Google Sheets. You’re going to do this by enabling an IFTTT applet.

First, go to IFTTT (create an IFTTT account if you don’t have one), click on My Applets, and then New Applet.

new ifttt applet

Click on This, and then type SMS in the search field.

Choose SMS.

Select Send IFTTT an SMS tagged.

ifttt sms trigger

Next, type #savepage in the field for Tag.

This tells IFTTT to trigger the applet any time you send IFTTT an SMS message where you use the #savepage tag in the message.

Don’t worry about what phone number to send the message to, you’ll get that number further along in the process.

ifttt trigger tag

You’re almost done this step. Click Create trigger, and then on the next page click on That.

This brings up the Action search page.

Write a new field to a Google spreadsheet that will store the URL of the web page you want to save.

Search for “Sheets” and choose the Sheets action.

google sheets ifttt action

On the next page, you’re going to choose Update cell in spreadsheet.

This tells IFTTT that every time you send an SMS started with #savepage, you want IFTTT to update a specific cell in a spreadsheet in your Google Drive account The Only Google Drive Guide You'll Ever Need to Read The Only Google Drive Guide You'll Ever Need to Read Google Drive is the perfect combination of online file storage and document management tools. We explain how to best use Google Drive on- and offline, by yourself and in collaboration with others. Read More .

sheets cell udpate action

On the next page is where you set up the specifics of this action.

Set up the fields on this next page as follows.

  • Drive folder path: IFTTT/SMS
  • Spreadsheet name: Article Warehouse
  • Which cell: A2
  • Value: {{Message}}

Before you click on Create, go into your Google Drive account, create the directory IFTTT/SMS, and create a spreadsheet to hold the URL you’ll be sending it.

Make the spreadsheet look like this:

spreadsheet to save url

Give the spreadsheet name the exact name you’ve defined in the Spreadsheet name field.

As you can see, cell A2 is blank, and ready to receive the URL value that you’re going to be sending to IFTTT via SMS.

Now, back on IFTTT, click on Create.

Make a note of the phone number that you need to send your SMS to in order to save web pages you want to read later.

Step 2: Save URL to Google Drive

Now you have an automated system to SMS the URL you want to save to a Google Sheet.

Next, you’ll need to create a Google Script to convert that URL to a PDF and save it in a special “MyArticles” folder in your Google Drive account. Don’t worry, we’ve written the script for you, and it’s very simple.

But first, create a new directory in your Google Drive account called “MyArticles”. Right-click on it and choose Get shareable link.

get shareable link

Paste this to notepad and set it aside. You’re going to need the special ID at the end of that link later.

Now, go back to the Article Warehouse Google Sheet you created above.

To create a new Google Script, click on Tools and then Script editor. Rename this project as SaveURL. Then paste the follow script in Code.gs:

function myFunction() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Sheet1'); 
  var range = sheet.getRange(2,1); 
  var data = range.getValue();  
  var URLtext = data.substring(10,data.length)
  var response = UrlFetchApp.fetch(URLtext);
  var htmlBody = response.getContentText();
  var blob = Utilities.newBlob(htmlBody, 'text/html').getAs('application/pdf').setName(Date() + '_MyArticle.pdf');
  var folder = DriveApp.getFolderById("<type your folder ID here>")
  var file = folder.createFile(blob);
}

Here’s how this script works, step-by-step:

  1. Pulls the URL that’s stored in cell A2 (this is what “getRange(2,1)” does)
  2. Strips the first 10 characters, “#savepage” from the URL string
  3. Fetches the web page from the internet
  4. Converts the web page to PDF format
  5. Saves the PDF file to the drive that you’ve specified.

In the script, replace “<type your folder ID here>” with the ID of your folder from the notepad file you saved above.

get google drive folder id

Save this script by clicking on the disk save icon.

Step 3: Trigger the Script on Sheet Update

You want your script to run every single time the spreadsheet changes. A change in the spreadsheet means you’ve sent a new SMS with a new URL to save.

To do this, in the Script Editor window, click on Edit and then Current project’s triggers.

current project triggers

You’ll see that there are no triggers present for this project yet.

Click on the blue link, Click here to add one now.

trigger script on sheet change

Configure the trigger by setting “Run” to myFunction, and “Events” to From spreadsheet, and On change.

Now your entire project is finished and ready to test!

Step 4: Testing Your Script

On your mobile phone, send an SMS to the phone number you recorded above. Make sure to include “#savepage” in front of the URL.

Just copy the URL from your mobile browser window, and paste it into the SMS message.

send url via sms

Next, check to make sure IFTTT worked properly.

Go to your IFTTT account, click on the Applet you created for this project, and check when it last ran.

check when applet ran

If everything worked properly, it should have just ran recently.

Once you’ve confirmed your IFTTT applet is working, next go to your Google Drive account and check the folder you created for your articles.

You should see a new PDF file appeared in the last few minutes.

verify pdf file

Open the PDF and make sure that it saved the right web page.

You’ll notice that the images from the page aren’t included in the PDF version.

read saved pdf web page

Saving Information Online via SMS

The fact that images are left out is beneficial for a few reasons.

It dramatically reduces the size of the PDF file stored in your drive. It also lets you focus on saving text that you want to read later, and it makes the process of skimming and reading it later less distracting.

This is a very efficient way to quickly save academic papers on the web, news stories you want to read later, or any other text online you want to save quickly.

This was just one example. There are many other examples of how you can boost your productivity with Google Scripts 3 Sure Ways to Boost Your Productivity with Google Scripts 3 Sure Ways to Boost Your Productivity with Google Scripts It's possible to do all kinds of really cool automations with Google Scripts, and you don't even have to create them from scratch. Boost your productivity in a big way. Read More as well.

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Ray Waldo
    September 30, 2018 at 4:09 am

    I copied and pasted all the code but line 7 errors on me:
    Request failed for https://ift.tt/2DHSEyh returned code 403. Truncated server response: <!--< html xmlns="http://... (use muteHttpExceptions option to examine full response) (line 7, file "Code")
    What did I do wrong? It looks to me (non-coder) that IFTTT's shortened URL is the problem. Any ideas?

  2. Michael
    September 25, 2018 at 12:34 pm

    Or you could just use the menu at the top of browser tab and print the page as a PDF and save to Drive. Much easier than all this.

    • Ryan Dube
      September 25, 2018 at 12:43 pm

      After "all of this' is done, you just copy the URL and paste to SMS. That's much faster than clicking to save as PDF, opening the Drive app, hunting for the right folder, uploading the file, hunting for the directory on the phone where it was saved, and then uploading.

      This automation cuts 6-7 steps down to 2.

      Good automation uses a little bit of work upfront to cut down on future steps that add up to a lot of extra steps over time.