Mengelola Proyek
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Bagian ini memberikan ringkasan metode Apps Script API yang dapat Anda gunakan untuk membuat, membaca, mengubah, dan memantau project Apps Script Anda. Halaman contoh
Project Management
menampilkan contoh permintaan pengelolaan API. Dokumentasi referensi untuk setiap metode memberikan detail implementasi.
Ringkasan metode API |
Membuat project |
projects.create
Hasil: Buat project kosong dasar tanpa file project dan
manifes project default.
Opsi: Anda dapat memberikan judul project. Anda juga dapat
membuat skrip terikat dengan
memberikan ID Google Drive dari file Google Dokumen, Google Spreadsheet, Google Formulir, atau Slide
untuk bertindak sebagai induk skrip.
|
Membaca metadata project |
projects.get
Results: Mengambil objek
Project , yang merepresentasikan metadata project. Data ini mencakup
judul project, ID skrip, pengguna yang membuat, waktu pembuatan, dan
detail lainnya.
|
Membaca konten project |
projects.getContent
Hasil: Menampilkan array objek
File , satu untuk setiap file HTML dan kode dalam project. Daftar ini juga
mencakup manifest project
sebagai file JSON. Objek file berisi konten sumber file (File.source ) dan metadata lainnya, seperti daftar fungsi dalam file (File.functionSet ).
Opsi: Anda dapat menentukan
versi konten yang akan
diambil dengan parameter kueri.
|
Memperbarui konten project |
projects.updateContent
Hasil: Mengubah konten file dalam project skrip.
Anda menyediakan konten baru sebagai array objek
File . Salah satu objek File ini harus memiliki jenis JSON
dan merepresentasikan manifes project baru
project skrip. Konten
baru disimpan sebagai versi HEAD project. Digunakan saat
skrip dijalankan sebagai pemicu, di editor skrip, dalam mode pratinjau
add-on, atau sebagai aplikasi web atau Apps Script API dalam mode pengembangan.
Catatan: Saat memperbarui konten project skrip, praktik
umumnya adalah mengeluarkan
permintaan
projects.getContent
terlebih dahulu untuk mengambil array File yang ada, membuat
perubahan yang diinginkan pada objek tersebut, lalu menggunakan File sebagai
input untuk permintaan
projects.updateContent.
Peringatan: Konten baru akan menggantikan semua
file yang ada dalam project skrip. File yang tidak diperbarui oleh permintaan
akan dihapus.
|
Membaca metrik project |
projects.getMetrics
Hasil: Membaca metrik tertentu tentang project.
Metrik ini mencakup jumlah pengguna, total jumlah
eksekusi, total jumlah error eksekusi, dan detail lainnya.
Gunakan
MetricType
untuk menentukan informasi yang Anda minta.
Opsi: Membatasi hasil pada deployment atau fungsi skrip tertentu menggunakan
MetricsFilter.
Anda juga dapat menentukan interval metrik tertentu menggunakan
MetricsIntervalConfig.
|
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-31 UTC.
[null,null,["Terakhir diperbarui pada 2025-08-31 UTC."],[[["\u003cp\u003eThis section outlines Apps Script API methods for managing Apps Script projects, including creating, reading, updating, and monitoring.\u003c/p\u003e\n"],["\u003cp\u003eYou can create new projects, retrieve project metadata and content, and update project files using these methods.\u003c/p\u003e\n"],["\u003cp\u003eThe API allows you to access project metrics like user count, executions, and errors for analysis.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the provided links for detailed documentation and code samples on project management requests.\u003c/p\u003e\n"]]],[],null,["# Managing Projects\n\nThis section provides an overview of the Apps Script API methods\nyou can use to create, read, modify,\nand monitor your Apps Script projects. The\n[Project Management](/apps-script/api/samples/manage)\nsamples page shows examples of API management requests. The reference\ndocumentation for each method provides implementation details.\n\n| **API method overview** ||\n|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Create projects** | [projects.create](/apps-script/api/reference/rest/v1/projects/create) **Results** : Create a basic, empty project with no project files and a default [project manifest](/apps-script/concepts/manifests). **Options** : You can provide a project title. You can also create a [bound script](/apps-script/guides/bound) by providing the Google Drive ID of a Google Docs, Google Sheets, Google Forms, or Slides file to act as the script's parent. |\n| **Read project metadata** | [projects.get](/apps-script/api/reference/rest/v1/projects/get) **Results** : Retrieves a [`Project`](/apps-script/api/reference/rest/v1/projects#Project) object, which represents project metadata. This data includes the project title, script ID, creating user, creation time, and other details. |\n| **Read project content** | [projects.getContent](/apps-script/api/reference/rest/v1/projects/getContent) **Results** : Returns an array of [`File`](/apps-script/api/reference/rest/v1/File) objects, one for each code and HTML file in the project. The list also includes the [project manifest](/apps-script/concepts/manifests) as a JSON file. File objects contain the source content of the file (`File.source`) and other metadata, such a list of functions in the file (`File.functionSet`). **Options** : You can specify which [version](/apps-script/guides/versions) of the content to retrieve with a query parameter. |\n| **Update project content** | [projects.updateContent](/apps-script/api/reference/rest/v1/projects/updateContent) **Results** : Changes the file content in a script project. You provide the new content as an array of [`File`](/apps-script/api/reference/rest/v1/File) objects. One of these `File` objects must have JSON type and represent the script project's new [project manifest](/apps-script/concepts/manifests). The new content is stored as the HEAD version of the project. It is used when the script executes as a trigger, in the script editor, in add-on preview mode, or as a web app or Apps Script API in development mode. **Note** : When updating script project content, common practice is to first issue a [projects.getContent](/apps-script/api/reference/rest/v1/projects/getContent) request to retrieve an array of the existing `File`s, make the desire to those objects, then use the `File`s as input for a [projects.updateContent](/apps-script/api/reference/rest/v1/projects/updateContent) request. **Warning:** The new content replaces all existing files in the script project. Files not updated by the request are removed. |\n| **Read project metrics** | [projects.getMetrics](/apps-script/api/reference/rest/v1/projects/getMetrics) **Results** : Read certain metrics about a project. These metrics include the number of users, the total number of executions, the total number of execution errors, and other details. Use a [MetricType](/apps-script/api/reference/rest/v1/projects/getMetrics#metrictype) to specify the information you are requesting. **Options** : Restrict the results to specific deployments or script functions using a [MetricsFilter](/apps-script/api/reference/rest/v1/projects/getMetrics#MetricsFilter). You can also define a specific metric interval using a [MetricsIntervalConfig](/api/reference/rest/v1/projects/getMetrics#metricsintervalconfig). |"]]