Zarządzanie projektami
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
W tej sekcji znajdziesz omówienie metod interfejsu Apps Script API, których możesz używać do tworzenia, odczytywania, modyfikowania i monitorowania projektów Apps Script. Na stronie z przykładami zarządzania projektami znajdziesz przykłady żądań zarządzania interfejsami API. Szczegółowe informacje o wdrażaniu znajdziesz w dokumentacji referencyjnej każdej metody.
Omówienie metod API |
Tworzenie projektów |
projects.create
Wyniki: utworzenie podstawowego, pustego projektu bez plików projektu i domyślnego pliku manifestu projektu.
Opcje: możesz podać tytuł projektu. Możesz też utworzyć skrypt powiązany, podając identyfikator Dysku Google pliku Dokumentów Google, Arkuszy Google, Formularzy Google lub Prezentacji Google, który będzie pełnić rolę elementu nadrzędnego skryptu.
|
Odczytywanie metadanych projektu |
projects.get
Wyniki: pobiera obiekt
Project , który reprezentuje metadane projektu. Te dane obejmują tytuł projektu, identyfikator skryptu, użytkownika, który go utworzył, czas utworzenia i inne szczegóły.
|
Czytanie treści projektu |
projects.getContent
Wyniki: zwraca tablicę obiektów File , po jednym dla każdego pliku kodu i HTML w projekcie. Lista zawiera też manifest projektu w postaci pliku JSON. Obiekty plików zawierają treść źródłową pliku (File.source ) i inne metadane, takie jak lista funkcji w pliku (File.functionSet ).
Opcje: możesz określić, która wersja treści ma zostać pobrana za pomocą parametru zapytania.
|
Aktualizowanie treści projektu |
projects.updateContent
Wyniki: zmienia zawartość pliku w projekcie skryptu.
Nowe treści podajesz jako tablicę obiektów File . Jeden z tych obiektów File musi mieć typ JSON i reprezentować nowy plik manifestu projektu. Nowa treść jest przechowywana jako wersja HEAD projektu. Jest używany, gdy skrypt jest wykonywany jako wyzwalacz, w edytorze skryptów, w trybie podglądu dodatku lub jako aplikacja internetowa lub interfejs Apps Script API w trybie programowania.
Uwaga: podczas aktualizowania treści projektu skryptu zwykle najpierw wysyła się żądanie
projects.getContent, aby pobrać tablicę istniejących obiektów File , wprowadzić w nich zmiany, a następnie użyć ich jako danych wejściowych w żądaniu
projects.updateContent.File
Ostrzeżenie: nowa treść zastąpi wszystkie istniejące pliki w projekcie skryptu. Pliki, które nie zostały zaktualizowane przez żądanie, są usuwane.
|
Odczytywanie danych projektu |
projects.getMetrics
Wyniki: odczytywanie określonych danych o projekcie.
Obejmują one liczbę użytkowników, łączną liczbę uruchomień, łączną liczbę błędów wykonania i inne szczegóły.
Użyj elementu
MetricType
, aby określić informacje, o które prosisz.
Opcje: ogranicz wyniki do określonych wdrożeń lub funkcji skryptu za pomocą
MetricsFilter.
Możesz też zdefiniować konkretny interwał danych za pomocą elementu
MetricsIntervalConfig.
|
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-31 UTC.
[null,null,["Ostatnia aktualizacja: 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). |"]]