Gestione dei progetti
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa sezione fornisce una panoramica dei metodi dell'API Apps Script
che puoi utilizzare per creare, leggere, modificare
e monitorare i tuoi progetti Apps Script. La pagina
Project Management
mostra esempi di richieste di gestione delle API. La documentazione di riferimento per ogni metodo fornisce i dettagli di implementazione.
Panoramica del metodo API |
Creare progetti |
projects.create
Risultati: crea un progetto di base vuoto senza file di progetto e un manifest del progetto predefinito.
Opzioni: puoi fornire un titolo del progetto. Puoi anche
creare uno script associato
fornendo l'ID Google Drive di un file di Documenti, Fogli, Moduli o Presentazioni Google
che funga da file principale dello script.
|
Leggere i metadati del progetto |
projects.get
Risultati: recupera un oggetto
Project , che rappresenta i metadati del progetto. Questi dati includono il
titolo del progetto, l'ID script, l'utente che lo ha creato, l'ora di creazione e altri
dettagli.
|
Leggere i contenuti del progetto |
projects.getContent
Risultati: restituisce un array di oggetti
File , uno per ogni codice e file HTML nel progetto. L'elenco include anche il manifest del progetto come file JSON. Gli oggetti file contengono i contenuti di origine del file
(File.source ) e altri metadati, ad esempio un elenco di funzioni
nel file (File.functionSet ).
Opzioni: puoi specificare la
versione dei contenuti da
recuperare con un parametro di query.
|
Aggiornare i contenuti del progetto |
projects.updateContent
Risultati: modifica il contenuto del file in un progetto di script.
Fornisci i nuovi contenuti come array di oggetti
File . Uno di questi oggetti File deve avere il tipo JSON
e rappresentare il nuovo manifest del progetto
del progetto di script. I nuovi
contenuti vengono memorizzati come versione HEAD del progetto. Viene utilizzato quando
lo script viene eseguito come trigger, nell'editor di script, in modalità
anteprima del componente aggiuntivo o come app web o API Apps Script in modalità di sviluppo.
Nota: quando aggiorni i contenuti del progetto di script, la prassi comune è di emettere prima una richiesta
projects.getContent per recuperare un array dei File esistenti, apportare le modifiche desiderate a questi oggetti, quindi utilizzare i File come input per una richiesta
projects.updateContent.
Avviso:i nuovi contenuti sostituiscono tutti
i file esistenti nel progetto di script. I file non aggiornati dalla richiesta
vengono rimossi.
|
Leggere le metriche del progetto |
projects.getMetrics
Risultati: leggi determinate metriche relative a un progetto.
Queste metriche includono il numero di utenti, il numero totale di
esecuzioni, il numero totale di errori di esecuzione e altri dettagli.
Utilizza un
MetricType
per specificare le informazioni che stai richiedendo.
Opzioni: limita i risultati a deployment specifici
o a funzioni di script utilizzando un
MetricsFilter.
Puoi anche definire un intervallo di metriche specifico utilizzando un
MetricsIntervalConfig.
|
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-08-31 UTC.
[null,null,["Ultimo aggiornamento 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). |"]]