Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tạo và chạy một quy trình tự động hoá đơn giản để tạo một tài liệu trên Google Tài liệu và gửi cho bạn một đường liên kết đến tài liệu đó qua email.
Mục tiêu
Thiết lập tập lệnh.
Chạy tập lệnh.
Điều kiện tiên quyết
Để sử dụng mẫu này, bạn cần đáp ứng các điều kiện tiên quyết sau:
Một Tài khoản Google (tài khoản Google Workspace có thể yêu cầu quản trị viên phê duyệt).
Một trình duyệt web có quyền truy cập vào Internet.
Thiết lập tập lệnh
Để tạo quy trình tự động hoá, hãy làm theo các bước sau:
Để mở trình chỉnh sửa Apps Script, hãy chuyển đến script.google.com. Nếu đây là lần đầu tiên bạn truy cập vào script.google.com, hãy nhấp vào Xem Trang tổng quan.
Nhấp vào Dự án mới.
Xoá mọi mã trong trình chỉnh sửa tập lệnh rồi dán mã bên dưới vào.
/** * 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);}}
Nhấp vào biểu tượng Lưu .
Nhấp vào Dự án chưa có tiêu đề.
Nhập tên cho tập lệnh rồi nhấp vào Đổi tên.
Chạy tập lệnh
Để chạy tập lệnh, hãy thực hiện các bước sau:
Nhấp vào Chạy.
Khi được nhắc, hãy cho phép tập lệnh chạy.
Nếu màn hình đồng ý OAuth hiển thị cảnh báo Ứng dụng này chưa được xác minh, hãy tiếp tục bằng cách chọn Nâng cao>Chuyển đến {Tên dự án} (không an toàn).
Khi quá trình thực thi tập lệnh hoàn tất, hãy kiểm tra hộp thư đến trong Gmail để tìm email.
Mở email rồi nhấp vào đường liên kết để mở tài liệu mà bạn đã tạo.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-26 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."]]],[]]