mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
28 lines
944 B
TypeScript
28 lines
944 B
TypeScript
/// <reference path="google-apps-script.document.d.ts" />
|
|
/// <reference path="google-apps-script.gmail.d.ts" />
|
|
|
|
// from https://developers.google.com/apps-script/overview
|
|
|
|
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);
|
|
}
|