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.
Click on This, and then type SMS in the search field.
Choose SMS.
Select Send IFTTT an SMS tagged.
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.
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.
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.
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:
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:
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.
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:
- Pulls the URL that’s stored in cell A2 (this is what “getRange(2,1)” does)
- Strips the first 10 characters, “#savepage” from the URL string
- Fetches the web page from the internet
- Converts the web page to PDF format
- 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.
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.
You’ll see that there are no triggers present for this project yet.
Click on the blue link, Click here to add one now.
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.
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.
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.
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.
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 as well.
Read the full article: How Sending One SMS Message Can Back Up a Web Page to Google Drive
from MakeUseOf https://ift.tt/2pxEgPa
via IFTTT
0 comments:
Post a Comment