ניהול פרויקטים
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בקטע הזה מופיעה סקירה כללית של שיטות Apps Script API שבהן אפשר להשתמש כדי ליצור, לקרוא, לשנות ולנטר את פרויקטי Apps Script. בדף הדוגמאות של Project Management מופיעות דוגמאות לבקשות לניהול API. במסמכי התיעוד של כל שיטה מפורטים פרטי ההטמעה.
סקירה כללית של שיטת API |
יצירת פרויקטים |
projects.create
תוצאות: יצירת פרויקט בסיסי וריק ללא קבצי פרויקט ועם מניפסט פרויקט שמוגדר כברירת מחדל.
אפשרויות: אפשר לציין שם לפרויקט. אפשר גם ליצור סקריפט שקשור לקובץ על ידי ציון מזהה Google Drive של קובץ Google Docs, Google Sheets, Google Forms או Slides שישמש כקובץ האב של הסקריפט.
|
קריאת מטא-נתונים של פרויקט |
projects.get
תוצאות: אחזור של אובייקט
Project שמייצג את המטא-נתונים של הפרויקט. הנתונים האלה כוללים את שם הפרויקט, מזהה הסקריפט, המשתמש שיצר אותו, זמן היצירה ופרטים נוספים.
|
קריאת תוכן בפרויקט |
projects.getContent
תוצאות: מחזירה מערך של אובייקטים מסוג File , אחד לכל קובץ קוד ו-HTML בפרויקט. הרשימה כוללת גם את מניפסט הפרויקט כקובץ JSON. אובייקטים של קבצים מכילים את תוכן המקור של הקובץ (File.source ) ומטא-נתונים אחרים, כמו רשימה של פונקציות בקובץ (File.functionSet ).
אפשרויות: אפשר לציין איזו גרסה של התוכן תאוחזר באמצעות פרמטר של שאילתה.
|
עדכון התוכן של הפרויקט |
projects.updateContent
תוצאות: שינוי תוכן הקובץ בפרויקט של סקריפט.
אתם מספקים את התוכן החדש כמערך של אובייקטים מסוג File . אחד מאובייקטי File האלה חייב להיות מסוג JSON ולייצג את מניפסט הפרויקט החדש של פרויקט הסקריפט. התוכן החדש מאוחסן כגרסת ה-HEAD של הפרויקט. הוא משמש כשמריצים את הסקריפט כטריגר, בכלי לעריכת סקריפטים, במצב תצוגה מקדימה של תוסף, או כאפליקציית אינטרנט או כ-API של Apps Script במצב פיתוח.
הערה: כשמעדכנים תוכן של פרויקט סקריפט, נהוג קודם לשלוח בקשה של
projects.getContent כדי לאחזר מערך של אובייקטים מסוג File , לבצע את השינויים הרצויים באובייקטים האלה ואז להשתמש באובייקטים מסוג File כקלט לבקשה של
projects.updateContent.
אזהרה: התוכן החדש מחליף את כל הקבצים הקיימים בפרויקט הסקריפט. קבצים שלא עודכנו על ידי הבקשה
מוסרים.
|
קריאת מדדים של פרויקט |
projects.getMetrics
תוצאות: קריאת מדדים מסוימים לגבי פרויקט.
המדדים האלה כוללים את מספר המשתמשים, המספר הכולל של ההפעלות, המספר הכולל של שגיאות ההפעלה ופרטים נוספים.
משתמשים ב-
MetricType
כדי לציין את המידע שרוצים לקבל.
אפשרויות: הגבלת התוצאות לפריסות ספציפיות או לפונקציות סקריפט באמצעות
MetricsFilter.
אפשר גם להגדיר מרווח זמן ספציפי למדד באמצעות
MetricsIntervalConfig.
|
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-31 (שעון UTC).
[null,null,["עדכון אחרון: 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). |"]]