[[["易于理解","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"]],["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eDevelop Apps Script projects locally using \u003ccode\u003eclasp\u003c/code\u003e, enabling the use of tools like \u003ccode\u003egit\u003c/code\u003e and offline editing.\u003c/p\u003e\n"],["\u003cp\u003eManage deployments, create versions, and update your Apps Script projects directly from the command line.\u003c/p\u003e\n"],["\u003cp\u003eStructure your Apps Script code into directories for better organization, mirroring the structure on script.google.com.\u003c/p\u003e\n"],["\u003cp\u003eRequires Node.js and installation via npm with the command \u003ccode\u003enpm install @google/clasp -g\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUse various \u003ccode\u003eclasp\u003c/code\u003e commands for tasks like login, creating projects, cloning, pushing/pulling code, deploying, and more.\u003c/p\u003e\n"]]],[],null,["# Use the command line interface with clasp\n\nTo develop and manage Apps Script projects from your terminal rather than the\nApps Script editor, you can use an open-source tool called `clasp`.\n\nThe [`clasp` codelab](http://g.co/codelabs/clasp) provides an overview of all\n`clasp` features.\n\nFeatures\n--------\n\n### Develop locally\n\n`clasp` lets you to develop your Apps Script projects locally. You can\nwrite code on your own computer and upload it to Apps Script when you're\ndone. You can also download existing Apps Script projects so that you can edit\nthem when you're offline. Since the code is local, you can use your favorite\ndevelopment tools like [`git`](https://git-scm.com/) when building Apps Script\nprojects.\n\n### Manage deployment versions\n\nCreate, update, and view your multiple\n[deployments](/apps-script/concepts/deployments) of your project.\n\n### Structure code\n\n`clasp` allows you to organize your code into directories, which are preserved\nwhen you upload them to script.google.com. For example: \n\n```\n# On script.google.com:\n├── tests/slides.gs\n└── tests/sheets.gs\n\n# Locally:\n├── tests/\n│ ├─ slides.gs\n│ └─ sheets.gs\n```\n\nRequirements\n------------\n\n`clasp` is written in [Node.js](https://nodejs.org/en/) and distributed via\nthe `npm` tool. Prior to using `clasp`, you must have\n[Node.js version 4.7.4 or later](https://nodejs.org/en/download/) installed.\nInstalling Node.js requires administrative privileges.\n\nInstallation\n------------\n\nOnce you've installed Node.js, you can use the following `npm` command to\ninstall `clasp`: \n\n npm install @google/clasp -g\n\nAfter installation, you can use the `clasp` command from any directory on\nyour computer.\n\nUsing `clasp`\n-------------\n\nYou can use `clasp` to handle a variety of tasks from the command line. This\nsection describes common operations you can use when developing with `clasp`.\n\n### Login\n\nThis command logs in and authorizes management of your Google account's\nApps Script projects. Once it is run, you are asked to sign into a Google\naccount where your Apps Script projects are stored. \n\n clasp login\n\n### Logout\n\nThis command logs out of the command line tool. You must re-login using\n`clasp login` to re-authenticate with Google before continuing to use `clasp`. \n\n clasp logout\n\n### Create a new Apps Script project\n\nThis command creates a new script in the current directory with an optional\nscript title. \n\n clasp create [scriptTitle]\n\nThis command also creates two files in the current directory:\n\n- A `.clasp.json` file storing the script ID.\n- An `appsscript.json` project manifest file containing project metadata.\n\n### Clone an existing project\n\nThis command clones an existing project in the current directory. The script\nmust be created or shared with your Google account. You specify the script\nproject to clone by providing its script ID.\n\nTo find the Script ID of the project, follow the below steps:\n\n1. Open Apps Script project.\n2. At the left, click **Project Settings** settings.\n3. Under IDs, copy the Script ID.\n\n clasp clone \u003cscriptId\u003e\n\n### Download a script project\n\nThis command downloads the Apps Script project from Google Drive to your\ncomputer's file system. \n\n clasp pull\n\n### Upload a script project\n\nThis command uploads all of a script project's files from your computer to\nGoogle Drive. \n\n clasp push\n\n### List project versions\n\nThis command lists the number and description of each of a script project's\nversions. \n\n clasp versions\n\n### Deploy a published project\n\nYou can deploy script projects as web apps, add-ons, or executables. You can\ncreate [deployments](/apps-script/concepts/deployments) in the script editor,\nin the project [manifest](/apps-script/concepts/manifests), or using `clasp`.\n\nTo deploy a project with `clasp`, first create an immutable version of the Apps\nScript project. A version is a \"snapshot\" of a script project and is similar to\na read-only branched release. \n\n clasp version [description]\n\nThis command displays the newly created version number. Using that number, you\ncan deploy and undeploy instances of your project: \n\n clasp deploy [version] [description]\n clasp undeploy \u003cdeploymentId\u003e\n\nThis command updates an existing deployment with a new version and description: \n\n clasp redeploy \u003cdeploymentId\u003e \u003cversion\u003e \u003cdescription\u003e\n\n### List deployments\n\nThis command lists the script project's deployment IDs, versions, and their\ndescriptions. \n\n clasp deployments\n\n### Open the project in the Apps Script editor\n\nThis command opens a script project in the Apps Script editor. The editor is\nlaunched as a new tab in your default web browser. \n\n clasp open\n\nContribute to the `clasp` open-source project\n---------------------------------------------\n\nContribute to `clasp` on [GitHub](https://github.com/google/clasp)."]]