/** * 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);}}
انقر على "حفظ" .
انقر على مشروع بلا عنوان.
أدخِل اسمًا للبرنامج النصي وانقر على إعادة التسمية.
تشغيل النص البرمجي
لتشغيل النص البرمجي، اتّبِع الخطوات التالية:
انقر على تشغيل.
امنح الإذن للنصّ البرمجي عند مطالبتك بذلك.
إذا عرضت شاشة الموافقة على OAuth التحذير لم يتم التحقّق من هذا التطبيق،
يمكنك المتابعة من خلال النقر على خيارات متقدمة>الانتقال إلى {اسم المشروع} (غير آمن).
عند اكتمال تنفيذ البرنامج النصي، راجِع البريد الوارد في Gmail
للبحث عن الرسالة الإلكترونية.
افتح الرسالة الإلكترونية وانقر على الرابط لفتح المستند الذي أنشأته.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["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."]]],[]]