November 22, 2017

How To Make A Web App to send the link of the Google Document to yourself or any of your friends Easily?

Google has it’s own Scripting page called Google App Script where you can start scripting your own Web apps. Many of you may not aware but from that website you can actually write your own codes and make application. After you are finished writing codes, just save it and you will get a link from where you can access your Web app.

Now Probably you need some help, so here is basics code on Google Apps Scripts which helps you to send the Google Document to yourself or any of your friends. First open Google App Script Editor and Paste the following lines of code.

[AdSense-A]

Google App Script Editor

[code lang=”js”]
function createAndSendDocument() {
// Create a new Google Doc named ‘Hello, world!’
var doc = DocumentApp.create(‘Hello, world!’);

// Access the body of the document, then add a paragraph.
doc.getBody().appendParagraph(‘This document was created by Google Apps Script.’);

// Get the URL of the document.
var url = doc.getUrl();

// Get the email address of the active user – that’s you.
var email = Session.getActiveUser().getEmail();

// Get the name of the document to use as an email subject line.
var subject = doc.getName();

// Append a new string to the "url" variable to use as an email body.
var body = ‘Link to your doc: ‘ + url;

// Send yourself an email with a link to the document.
GmailApp.sendEmail(email, subject, body);
}

[/code]

What this app does is, it sends you a link to a regular Google document to your Gmail as an Email. Now just save your code, and run it. It will ask for your authorization, go ahead and give it and again run it. Now if you check your Gmail you can see the Email and inside the Email there is a link. If you open the link it will take you to the simple Google document and it is automatically saved in your Google Drive.

Using this app you can send a document to yourself or any friends of yours. You can also Use Google script to send different email to different people at once easily.

[AdSense-C]

Hope it helps. Still some Questions? Need help on something. Just contact us, we are ready to help you.

About Bhattarai Diwas (thenepaltech) 213 Articles
I'm an Engineer and have Bachelor's Degree in Electrical and information technology. Right now I am working as a software developer in Germany. All in all I love programming and I am a tech geek.