כדי להשתמש בדוגמה הזו, אתם צריכים לעמוד בדרישות המוקדמות הבאות:
חשבון Google (יכול להיות שחשבונות Google Workspace ידרשו אישור אדמין).
דפדפן אינטרנט עם גישה לאינטרנט.
הגדרת הסקריפט
כדי ליצור את האוטומציה:
כדי לפתוח את הכלי לעריכת סקריפטים של Google Apps Script, עוברים אל script.google.com. אם זו הפעם הראשונה שאתם נכנסים אל script.google.com, לוחצים על צפייה בלוח הבקרה.
לוחצים על פרויקט חדש.
מוחקים את הקוד בכלי לעריכת סקריפטים ומדביקים את הקוד הבא.
/** * 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.
כשמוצגת בקשה, מאשרים את הסקריפט.
<<../samples/_snippets/oauth.md>>
[[["התוכן קל להבנה","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"]],["עדכון אחרון: 2026-04-01 (שעון UTC)."],[],[]]