/** * Creates a Google Doc and sends an email to the current user with a link to the doc. */functioncreateAndSendDocument(){try{// Create a new Google Doc named 'Hello, world!'constdoc=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.consturl=doc.getUrl();// Get the email address of the active user - that's you.constemail=Session.getActiveUser().getEmail();// Get the name of the document to use as an email subject line.constsubject=doc.getName();// Append a new string to the "url" variable to use as an email body.constbody='Link to your doc: '+url;// Send yourself an email with a link to the document.GmailApp.sendEmail(email,subject,body);}catch(err){// TODO (developer) - Handle exceptionconsole.log('Failed with error %s',err.message);}}
לוחצים על סמל השמירה .
לוחצים על פרויקט ללא שם.
מזינים שם לסקריפט ולוחצים על שינוי השם.
הפעלת הסקריפט
כדי להריץ את הסקריפט, פועלים לפי השלבים הבאים:
לוחצים על Run.
כשמוצגת בקשה, מאשרים את הסקריפט.
אם במסך ההסכמה ל-OAuth מוצגת האזהרה האפליקציה הזו לא אומתה, ממשיכים בתהליך על ידי בחירה באפשרות מתקדם>מעבר אל {שם הפרויקט} (לא בטוח).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-04 (שעון UTC)."],[[["This script automates the creation of a Google Doc and emails you a link for access."],["You'll need a Google Account and web browser to use this automation script."],["The script involves pasting provided code into the Apps Script editor and running it after authorization."],["Upon successful execution, you'll receive an email containing the link to your newly created Google Doc."],["Explore further options to extend functionalities with Google Docs, Sheets, and Slides or learn basic JavaScript."]]],[]]