スプレッドシート更新
This commit is contained in:
parent
099f4366ca
commit
bf772ed9f4
54
README.md
54
README.md
@ -1,3 +1,55 @@
|
||||
# gas-common-dev
|
||||
|
||||
Google Apps Scriptに関する共通ソース
|
||||
Google Apps Scriptに関する共通ソース
|
||||
|
||||
## Develop
|
||||
|
||||
Google Apps Script (GAS) は通常ブラウザのエディタで書きますが、
|
||||
VS Code でローカル開発 → GAS にデプロイ → ローカルである程度テストという流れも可能です。
|
||||
|
||||
#### GASの開発に必要なもの
|
||||
|
||||
* Node.js / npm
|
||||
* Google アカウント
|
||||
* clasp
|
||||
* VS Code
|
||||
|
||||
#### 開発構築
|
||||
|
||||
```sh
|
||||
# clasp をインストール
|
||||
npm install -g @google/clasp
|
||||
# GAS へのログイン
|
||||
clasp login
|
||||
# GASプロジェクトを作成する(JS)
|
||||
mkdir gas-sample
|
||||
cd gas-sample
|
||||
clasp create --type standalone --title "Sample GAS Project"
|
||||
# スプレッドシートの場合
|
||||
clasp create --type sheets --title "My Sheet Project"
|
||||
```
|
||||
|
||||
作成されたCode.jsにソースを書きます
|
||||
|
||||
Code.js
|
||||
```js
|
||||
function helloWorld() {
|
||||
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
|
||||
sheet.getRange(1, 1).setValue("Hello from JavaScript!");
|
||||
}
|
||||
```
|
||||
|
||||
GASにデプロイする
|
||||
|
||||
```sh
|
||||
clasp push
|
||||
# 強制
|
||||
# clasp push --force
|
||||
```
|
||||
|
||||
デプロイしたプロジェクトをスプレッドシートと紐づける必要があります
|
||||
|
||||
```sh
|
||||
clasp create --type sheets --title "My Sheet Project"
|
||||
```
|
||||
|
||||
|
||||
16
gas-sample/.clasp.json
Normal file
16
gas-sample/.clasp.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"scriptId": "1JhI9GMgJpjI-ogbtfOFYCRhlMd3NnlkQs6dNuvS0JwyuwMPG8Wct-OuM",
|
||||
"rootDir": "",
|
||||
"scriptExtensions": [
|
||||
".js",
|
||||
".gs"
|
||||
],
|
||||
"htmlExtensions": [
|
||||
".html"
|
||||
],
|
||||
"jsonExtensions": [
|
||||
".json"
|
||||
],
|
||||
"filePushOrder": [],
|
||||
"skipSubdirectories": false
|
||||
}
|
||||
4
gas-sample/Code.js
Normal file
4
gas-sample/Code.js
Normal file
@ -0,0 +1,4 @@
|
||||
function helloWorld() {
|
||||
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
|
||||
sheet.getRange(1, 1).setValue("Hello from JavaScript!");
|
||||
}
|
||||
7
gas-sample/appsscript.json
Normal file
7
gas-sample/appsscript.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"timeZone": "America/New_York",
|
||||
"dependencies": {
|
||||
},
|
||||
"exceptionLogging": "STACKDRIVER",
|
||||
"runtimeVersion": "V8"
|
||||
}
|
||||
0
readme/gcs.md
Normal file
0
readme/gcs.md
Normal file
Loading…
x
Reference in New Issue
Block a user