Tập lệnh độc lập
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ập lệnh độc lập là tập lệnh không liên kết với tệp Google Trang tính, Tài liệu, Trang trình bày hoặc Biểu mẫu. Các tập lệnh này xuất hiện trong số các tệp của bạn trên Google Drive.
Tạo một tập lệnh độc lập
Cách dễ nhất để tạo một tập lệnh độc lập là truy cập vào script.google.com
và ở trên cùng bên trái, hãy nhấp vào addDự án mới.
Bạn cũng có thể tạo tập lệnh độc lập trong Google Drive. Truy cập vào Google Drive rồi nhấp vào Mới > Tuỳ chọn khác > Google Apps Script.
Chạy một tập lệnh độc lập
Để chạy một hàm trong trình chỉnh sửa tập lệnh, ở trên cùng, hãy chọn tên của hàm mà bạn muốn thực thi rồi nhấp vào Chạy.
Sử dụng một tập lệnh độc lập
Nhiều tập lệnh độc lập là tập lệnh tiện ích – ví dụ: để tìm trong Google Drive những tệp cũ có tên chứa "chưa có tiêu đề" để bạn có thể xoá các tệp đó.
Bạn cũng có thể triển khai một tập lệnh độc lập dưới dạng ứng dụng web hoặc thiết lập để chạy tự động từ một trình kích hoạt có thể cài đặt.
Các tập lệnh độc lập của Apps Script phù hợp để phát triển tiện ích bổ sung đơn giản cho chính bạn, nhóm của bạn hoặc tổ chức của bạn. Đối với các dự án lớn hơn, hãy cân nhắc việc tạo một tiện ích bổ sung Google Workspace trên một môi trường thời gian chạy khác.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eStandalone Google Apps Scripts are independent scripts not tied to any specific Google file like Sheets, Docs, or Slides, and they reside in your Google Drive.\u003c/p\u003e\n"],["\u003cp\u003eYou can effortlessly create a standalone script by visiting script.google.com or through Google Drive by navigating to New > More > Google Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eStandalone scripts are often utilized as utilities to automate tasks, such as searching and deleting files, or deployed as web apps or triggered automatically.\u003c/p\u003e\n"],["\u003cp\u003eThey can be run directly from the script editor by selecting the desired function and clicking Run.\u003c/p\u003e\n"],["\u003cp\u003eAdditionally, add-ons for Google Workspace can now be published using standalone scripts.\u003c/p\u003e\n"]]],[],null,["# Standalone Scripts\n\nA standalone script is any script that is not\n[bound to a Google Sheets, Docs, Slides, or\nForms file](/apps-script/guides/bound). These scripts appear\namong your files\nin Google Drive.\n\nCreating a standalone script\n----------------------------\n\nThe easiest way to create a standalone script is to visit\n[`script.google.com`](https://script.google.com)\nand at the top left, click add**New project**.\n\nYou can also create standalone scripts from Google Drive. Go to [Google Drive](https://drive.google.com)\nand click **New \\\u003e More \\\u003e Google Apps Script**.\n\nRunning a standalone script\n---------------------------\n\nTo run a function from the script editor, at the top, select the name\nof the function you want to execute and click **Run**.\n\nUsing a standalone script\n-------------------------\n\nMany standalone scripts are utility scripts --- for example, to\n[search your Google Drive for old files whose name contains \"untitled\"](/apps-script/reference/drive/drive-app#searchFiles(String))\nso that you can delete them.\n\nA standalone script can also be deployed as a [web app](/apps-script/guides/web)\nor set up to run automatically from an\n[installable trigger](/apps-script/guides/triggers/installable).\n\nApps Script standalone scripts are suitable for lightweight\nadd-on development for yourself, your team, or your\norganization. For larger projects, consider building a Google Workspace\nadd-on on a [different runtime](/workspace/add-ons/guides/alternate-runtimes)\nenvironment."]]