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 ("")
var file = folder.createFile (blob);
}
Here's how to do this step by step in this script:
1. Drag the cached URL in cell A2 (this is the 'getRange (2.1)' done).
2. Get the first 10 characters, followed by '#savepage', from the URL string.
3. Fetch web pages from the Internet.
4. Convert website to PDF format.
5. Save the PDF file to the drive you specified.
In the script, replace "" with the ID of the directory in the notepad file you saved above.
Save this script by clicking the save drive icon.
You want your script to run every time the spreadsheet changes, and a change in the spreadsheet means you sent a new SMS containing a URL to save.
To do this, in the Script Editor window , click Edit and then click Current project's triggers .
You will see that there are no triggers available for this project.
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 whole project is complete and ready to run!
On your mobile phone, send SMS to the phone number you listed above. Make sure to include '#savepage' in front of the URL.
Just copy the URL from the browser window on your mobile phone and paste that URL into the SMS message.
Next, check to make sure IFTTT is working properly.
Access your IFTTT account, click on the Applet you created for this project and check when it last ran.
If everything works normally, the last time it runs will be close to the current time.
Once you have confirmed that your IFTTT application is working, go to your Google Drive account and check the folder you created for your article.
You will see a new PDF file appear in the last few minutes.
Open the PDF file and make sure it has saved the website accordingly.
You will notice that images from the page are not included in the PDF version.
In fact, the removal of images is useful and there are several reasons for this.
It greatly reduces the size of PDF files stored in the drive. It also lets you focus on saving the text you want to read later, and it makes the later skimming process less distracting.
This is a very effective way to quickly save web-based academic materials, news stories you want to read later, or any other online text you want.
This is just an example. There are many other examples of how you can increase your productivity with Google Scripts.
Good luck!
See more: