קל לארגן דפים בעזרת אוספים אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
פרויקט סקריפט מייצג אוסף של קבצים ומשאבים ב-Google Apps Script, ולפעמים הוא נקרא פשוט 'סקריפט'. פרויקט של סקריפט כולל קובץ סקריפט אחד או יותר, שיכולים להיות קובצי קוד (עם הסיומת .gs) או קובצי HTML (עם הסיומת .html). אפשר גם לכלול JavaScript ו-CSS בקובצי HTML.
בכל רגע נתון, פתוח בעורך הסקריפטים פרויקט אחד בלבד. אתם יכולים לפתוח כמה פרויקטים בכמה חלונות או כרטיסיות בדפדפן.
יצירה ומחיקה של פרויקטים
בקטע הזה מוסבר איך ליצור ולמחוק פרויקטים עצמאיים או פרויקטים של Apps Script שמשויכים למסמך.
משמאל לפרויקט שרוצים למחוק, לוחצים על סמל האפשרויות הנוספות more_vert > הסרה > הסרה.
ניהול קבצים בפרויקט
יצירת קובץ
פותחים את פרויקט Apps Script.
בצד ימין, לוחצים על עורךcode > הוספה add.
בוחרים את סוג הקובץ שרוצים ליצור ונותנים לו שם.
איך מוחקים קובץ
פותחים את פרויקט Apps Script.
בצד ימין, לוחצים על עורךcode.
לצד הקובץ שרוצים למחוק, לוחצים על סמל האפשרויות הנוספות more_vert > מחיקה.
ייצוא קבצים מפרויקט Apps Script
כדי להוציא קובצי קוד מ-Apps Script, אפשר להעתיק ולהדביק את הקוד מכל קובץ בכלי לעריכת טקסט או להשתמש ב-clasp בשורת הפקודה. כדי להשתמש ב-clasp, אפשר לעיין במאמר בנושא הורדת פרויקט של סקריפט.
הגדרת אזור הזמן של פרויקט
אפשר להגדיר את אזור הזמן לפרויקט Apps Script. הפונקציות שמבוצעות על ידי הסקריפט משתמשות באזור הזמן הזה.
פותחים את פרויקט Apps Script.
בצד ימין, לוחצים על הגדרות הפרויקט.
בקטע אזור זמן, בוחרים את אזור הזמן שרוצים להשתמש בו.
אם רוצים שפונקציה מסוימת תשתמש באזור זמן שונה מזה של פרויקט הסקריפט, צריך להזין את אזור הזמן באופן מפורש בפונקציה. לדוגמה, בדוגמה שלמטה, כל פונקציה יוצרת אירוע חדש ביומן Google. הפונקציה הראשונה מוגדרת כברירת מחדל לאזור הזמן של הפרויקט. הפונקציה השנייה מציינת את אזור הזמן של החוף המערבי של ארה"ב, ולכן האירוע מתוזמן לפי אזור הזמן הזה, בלי קשר לאזור הזמן של הפרויקט.
functioncreateEvent(){//Createsaneventinthescriptproject's time zone and logs the IDvarevent=CalendarApp.getDefaultCalendar().createEvent('New test event',newDate('December 20, 2022 17:00:00'),newDate('December 20, 2022 18:00:00'));console.log('Event ID: '+event.getId());}functioncreateEventPacific(){//CreatesaneventwithaspecifiedtimezoneandlogstheeventID.varevent=CalendarApp.getDefaultCalendar().createEvent('New sample event',newDate('December 20, 2022 17:00:00 PDT'),newDate('December 20, 2022 18:00:00 PDT'));console.log('Event ID: '+event.getId());}
פתרון בעיות בכמה חשבונות Google
אם אתם מחוברים לכמה חשבונות Google בו-זמנית, יכול להיות שתיתקלו בבעיות בגישה לתוספים ולאפליקציות אינטרנט. פרויקטים, תוספים ואפליקציות אינטרנט של Apps Script לא תומכים בהתחברות לכמה חשבונות Google בו-זמנית.
אם פותחים את עורך Apps Script כשמחוברים ליותר מחשבון אחד, Google מבקשת לבחור את החשבון שרוצים להמשיך איתו.
אם פותחים אפליקציית אינטרנט או תוסף ונתקלים בבעיות שקשורות להתחברות לכמה חשבונות ב-זמנית, אפשר לנסות אחד מהפתרונות הבאים:
יוצאים מכל חשבונות Google ונכנסים רק לחשבון שבו נמצאים התוסף או אפליקציית האינטרנט שרוצים לגשת אליהם.
פותחים חלון פרטי ב-Google Chrome או חלון מקביל לגלישה פרטית, ונכנסים לחשבון Google שבו נמצאים התוסף או אפליקציית האינטרנט שרוצים לגשת אליהם.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-04 (שעון UTC)."],[[["\u003cp\u003eAn Apps Script project is a collection of files and resources, including code (\u003ccode\u003e.gs\u003c/code\u003e) and HTML (\u003ccode\u003e.html\u003c/code\u003e) files, that can be created as standalone entities or bound to Google Workspace documents.\u003c/p\u003e\n"],["\u003cp\u003eProjects can be created and deleted through the Apps Script editor, Google Drive, or specific Google Workspace applications like Docs, Sheets, Slides, and Forms.\u003c/p\u003e\n"],["\u003cp\u003eUsers can manage files within their projects, including creating, deleting, and exporting them, as well as setting the project's time zone.\u003c/p\u003e\n"],["\u003cp\u003ePotential issues arising from multiple Google Account logins can be mitigated by selecting the appropriate account or using private browsing modes.\u003c/p\u003e\n"]]],[],null,["A script project represents a collection of files and resources in\nGoogle Apps Script, sometimes referred to simply as \"a script\". A script project\nhas one or more script files which can either be code files (having a `.gs`\nextension) or HTML files (a `.html` extension). You can also include\nJavaScript and CSS in HTML files.\n\nThe script editor always has one and only one project opened at any given time.\nYou can open multiple projects in multiple browser windows or tabs.\n\nCreate and delete projects\n\nThis section explains how to create and delete standalone or\ncontainer-bound Apps Script projects.\n\nCreate a standalone project\n\nTo create a standalone project from Apps Script:\n\n1. Go to [`script.google.com`](https://script.google.com/).\n2. Click add **New Project**.\n3. In the script editor, click **Untitled project**.\n4. Give your project a name and click **Rename**.\n\nCreate a standalone project from Google Drive\n\n1. Open [Google Drive](https://drive.google.com/).\n2. Click **New** \\\u003e **More** \\\u003e **Google Apps Script**.\n\nCreate a container-bound project from Google Docs, Sheets, or Slides\n\n1. Open a Docs document, a Sheets spreadsheet, or Slides presentation.\n2. Click **Extensions** \\\u003e **Google Apps Script**.\n3. In the script editor, click **Untitled project**.\n4. Give your project a name and click **Rename**.\n\nCreate a container-bound project from Google Forms\n\n1. Open a form in Google Forms.\n2. Click More more_vert \\\u003e **Script editor**.\n3. In the script editor, click **Untitled project**.\n4. Give your project a name and click **Rename**.\n\nCreate a standalone project using the `clasp` command line tool\n\n`clasp` is a command line tool that allows you create, pull/push, and deploy Apps\nScript projects from a terminal.\n\nSee the [Command Line Interface using `clasp` guide](/apps-script/guides/clasp)\nfor more details.\n\nDelete a container-bound project **Warning:** Once you delete a container-bound Apps Script project, it can't be recovered.\n\n1. Open your container-bound project using the appropriate method above.\n2. At the top left, click **Overview** info_outline.\n3. At the top right, click Remove delete \\\u003e **Delete forever**.\n\n| Only the owner of the container can see the deletion menu options.\n\nDelete a standalone project\n\n1. Go to [`script.google.com`](https://script.google.com/).\n2. At the right of the project you want to delete, click More more_vert \\\u003e **Remove** \\\u003e **Remove**.\n\nManage files in a project\n\nCreate a file\n\n1. Open your Apps Script project.\n2. At the left, click **Editor** code \\\u003e Add add.\n3. Select the type of file to create and give it a name.\n\nDelete a file Deleted files can't be recovered.\n\n1. Open your Apps Script project.\n2. At the left, click **Editor** code.\n3. Next to the file you want to delete, click More more_vert \\\u003e **Delete**.\n\nExport files out of an Apps Script project\n\nTo take code files out of Apps Script, you can either copy and paste the code\nfrom each file into your preferred text editor or use clasp on the command line.\nTo use clasp, refer to [download a\nscript project](/apps-script/guides/clasp#download_a_script_project).\n\nSet the time zone for a project\n\nYou can set the time zone for an Apps Script project. Functions performed by the\nscript use this time zone.\n\n1. Open your Apps Script project.\n2. At the left, click **Project Settings** .\n3. In the **Time zone** section, select the time zone you want to use.\n\nIf you want a specific function to use a different time zone than the script\nproject's, explicitly enter the time zone in your function. For example, in the\nbelow sample, each function creates a new event in Google Calendar. The first\nfunction defaults to the project time zone. The second function specifies the\nPacific time zone, so the event is scheduled in Pacific time, regardless of the\nproject's time zone. \n\n function createEvent(){\n // Creates an event in the script project's time zone and logs the ID\n var event = CalendarApp.getDefaultCalendar().createEvent('New test event',\n new Date('December 20, 2022 17:00:00'),\n new Date('December 20, 2022 18:00:00'));\n console.log('Event ID: ' + event.getId());\n }\n function createEventPacific(){\n // Creates an event with a specified time zone and logs the event ID.\n var event = CalendarApp.getDefaultCalendar().createEvent('New sample event',\n new Date('December 20, 2022 17:00:00 PDT'),\n new Date('December 20, 2022 18:00:00 PDT'));\n console.log('Event ID: ' + event.getId());\n }\n\nFix issues with multiple Google Accounts \n\nIf you're logged into multiple Google Accounts at the same time, you might\nhave trouble accessing your add-ons and web apps.\nMulti-login, or\nbeing logged into multiple Google Accounts at once, isn't supported for Apps\nScript, add-ons, or web apps.\n\n- **If you open the Apps Script editor** while logged in to more than one account,\n Google prompts\n you to choose the account you want to proceed with.\n\n- **If you open a web app or add-on** and experience multi-login issues, try one of\n the following solutions:\n\n - Log out of all your Google Accounts and only log in to the one that has the add-on or web app you want to access.\n - Open an incognito window in Google Chrome, or an equivalent private browsing window, and log in to the Google Account that has the add-on or web app you want to access."]]