You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a CLI tool to execute Google Apps Script (GAS) on a terminal. Also this CLI tool can be used for managing files in Google Drive for OAuth2 and Service Account.
11
12
12
13
<aname="Demo"></a>
14
+
13
15
# Demo
16
+
14
17

15
18
16
19
<aname="Description"></a>
20
+
17
21
# Description
22
+
18
23
Will you want to develop GAS on your local PC? Generally, when we develop GAS, we have to login to Google using own browser and develop it on the Script Editor. Recently, I have wanted to have more convenient local-environment for developing GAS. So I created this "ggsrun". The main work is to execute GAS on local terminal and retrieve the results from Google. Furthermore, this tool can be also used for managing files in own Google Drive (OAuth2) and Google Drive for Service Account.
19
24
20
25
Features of "ggsrun" are as follows.
@@ -37,23 +42,29 @@ Features of "ggsrun" are as follows.
37
42
1.**[ggsrun got to be able to be used by not only OAuth2, but also Service Account.](help/README.md#useserviceaccount)** <sup><fontcolor="Red">Updated! (v1.7.0)</font></sup>
38
43
39
44
<aname="howtoinstall"></a>
45
+
40
46
# How to Install
41
47
42
48
December 28, 2021: If you want to simply test ggsrun, you can also use [this method](https://gist.github.com/tanaikech/695f7016b04e4c4156ad928e9482ead9).
43
49
44
50
## 1. Get ggsrun
51
+
45
52
Download an executable file of ggsrun from [the release page](https://github.com/tanaikech/ggsrun/releases) and import to a directory with path.
46
53
47
54
or
48
55
49
56
Use go get.
50
57
51
-
~~~bash
52
-
$ go get -u github.com/tanaikech/ggsrun
53
-
~~~
58
+
```bash
59
+
$ go install github.com/tanaikech/ggsrun@latest
60
+
```
61
+
62
+
-`GO111MODULE=on`
54
63
55
64
<aname="BasicSettingFlow"></a>
65
+
56
66
## Before Basic setting flow
67
+
57
68
**IMPORTANT: Please check this.**
58
69
59
70
At April 8, 2019, the specification of Google Apps Script Project was changed. By this, when new GAS project is created after April 8, 2019, in order to use Goole API (Google Apps Script API and Drive API which can be used by ggsrun.), the GAS project is required to link to Cloud Platform Project. When you use the GAS project creted after April 8, 2019, at first, please do [this flow](https://gist.github.com/tanaikech/e945c10917fac34a9d5d58cad768832c).
@@ -64,58 +75,63 @@ After the GAS project was linked to Cloud Platform Project by above flow, please
64
75
-[Ref2: Linking Cloud Platform Project to Google Apps Script Project](https://gist.github.com/tanaikech/e945c10917fac34a9d5d58cad768832c)
65
76
66
77
## 2. Basic setting flow
78
+
67
79
When you click each link of title, you can see the detail information.
68
80
69
81
1.[Setup ggsrun Server (at Google side)](help/README.md#setupggsrunserver)
70
-
- Create new project and install the server as a library.
71
-
-[Deploy API executable](https://developers.google.com/apps-script/api/how-tos/execute#step_1_deploy_the_script_as_an_api_executable). Choose "Only myself" as "Who has access to the script"
72
-
-[Install the server as a library.](https://developers.google.com/apps-script/guides/libraries#managing_libraries) Script ID of the library is
-**<u>After installed the library, please push the save button at the script editor.</u>** This is very important! By this, the library is completely reflected.
82
+
- Create new project and install the server as a library.
83
+
-[Deploy API executable](https://developers.google.com/apps-script/api/how-tos/execute#step_1_deploy_the_script_as_an_api_executable). Choose "Only myself" as "Who has access to the script"
84
+
-[Install the server as a library.](https://developers.google.com/apps-script/guides/libraries#managing_libraries) Script ID of the library is
-**<u>After installed the library, please push the save button at the script editor.</u>** This is very important! By this, the library is completely reflected.
- ggsrun uses Google Apps Script API and Drive API. Please enable them at API console. You can directly access them as follows. Project ID can be seen at downloaded ``client_secret.json``.
89
-
-``https://console.cloud.google.com/apis/library/script.googleapis.com/?project=### project ID ###``
90
-
- **Also here [https://script.google.com/home/usersettings](https://script.google.com/home/usersettings) has to be enabled. Please turn ON.**
91
-
-``https://console.cloud.google.com/apis/api/drive.googleapis.com/?project=### project ID ###``
100
+
- ggsrun uses Google Apps Script API and Drive API. Please enable them at API console. You can directly access them as follows. Project ID can be seen at downloaded `client_secret.json`.
101
+
-`https://console.cloud.google.com/apis/library/script.googleapis.com/?project=### project ID ###`
102
+
-**Also here [https://script.google.com/home/usersettings](https://script.google.com/home/usersettings) has to be enabled. Please turn ON.**
103
+
-`https://console.cloud.google.com/apis/api/drive.googleapis.com/?project=### project ID ###`
92
104
1.[Create configure file for ggsrun](help/README.md#Createconfigurefile)
93
-
- Run ``$ ggsrun auth`` at the directory with ``client_secret.json``.
105
+
- Run `$ ggsrun auth` at the directory with `client_secret.json`.
94
106
1.[Test Run](help/README.md#runggsrun)
95
-
- Create a sample script ``function main(){return Beacon()}`` as ``sample.gs``.
96
-
- Run ``$ ggsrun e2 -s sample.gs -i [Script ID] -j``. Script ID is ID of the project installed the server.
107
+
- Create a sample script `function main(){return Beacon()}` as `sample.gs`.
108
+
- Run `$ ggsrun e2 -s sample.gs -i [Script ID] -j`. Script ID is ID of the project installed the server.
97
109
98
110
Congratulation! You got ggsrun!
99
111
100
112
<aname="from134to140"></a>
113
+
101
114
# To users which are using ggsrun with v1.3.4 and/or less <sup><fontcolor="Red">Updated! (v1.4.0)</font></sup>
115
+
102
116
Please reauthorize to include a new scope to the access token as follows.
103
117
104
-
1. Confirm whether Google Apps Script API is enabled. You can directly access it as follows. Project ID can be seen at the downloaded ``client_secret.json``.
105
-
-``https://console.cloud.google.com/apis/library/script.googleapis.com/?project=### project ID ###``
106
-
- Also here [https://script.google.com/home/usersettings](https://script.google.com/home/usersettings) has to be enabled. Please turn ON.
107
-
1. Add a scope of ``https://www.googleapis.com/auth/script.projects`` to ``ggsrun.cfg``.
108
-
1. Run the following command under the directory with ``client_secret.json`` and ``ggsrun.cfg``.
109
-
-``$ ggsrun auth``
118
+
1. Confirm whether Google Apps Script API is enabled. You can directly access it as follows. Project ID can be seen at the downloaded `client_secret.json`.
119
+
-`https://console.cloud.google.com/apis/library/script.googleapis.com/?project=### project ID ###`
120
+
- Also here [https://script.google.com/home/usersettings](https://script.google.com/home/usersettings) has to be enabled. Please turn ON.
121
+
1. Add a scope of `https://www.googleapis.com/auth/script.projects` to `ggsrun.cfg`.
122
+
1. Run the following command under the directory with `client_secret.json` and `ggsrun.cfg`.
123
+
-`$ ggsrun auth`
110
124
111
125
Completed!
112
126
113
127
<aname="from170"></a>
128
+
114
129
# From version 1.7.0, ggsrun can access to Google Drive using Service Account. <sup><fontcolor="Red">Updated! (v1.7.0)</font></sup>
115
-
ggsrun can access to Google Drive using [Service Account](https://developers.google.com/identity/protocols/OAuth2ServiceAccount). When OAuth2 is used, you can see the files and folders in own Google Drive. When Service Account is used, you can see them in Google Drive for Service Account. Namely, the Drive for OAuth2 is different from that for Service Account. Please be careful this. And when Service Account is used, there are what it can do and what it can't do. About them, please read [here](help/README.md#useserviceaccount).
116
130
131
+
ggsrun can access to Google Drive using [Service Account](https://developers.google.com/identity/protocols/OAuth2ServiceAccount). When OAuth2 is used, you can see the files and folders in own Google Drive. When Service Account is used, you can see them in Google Drive for Service Account. Namely, the Drive for OAuth2 is different from that for Service Account. Please be careful this. And when Service Account is used, there are what it can do and what it can't do. About them, please read [here](help/README.md#useserviceaccount).
117
132
118
133
# How to use ggsrun
134
+
119
135
1.[Executes GAS and Retrieves Result Values](help/README.md#executesgasandretrievesresultvalues)
120
136
1.[Executes GAS with Values and Retrieves Feedbacked Values](help/README.md#executesgaswithvaluesandretrievesfeedbackedvalues)
121
137
1.[For Debug](help/README.md#fordebug)
@@ -136,12 +152,14 @@ ggsrun can access to Google Drive using [Service Account](https://developers.goo
136
152
1.[ggsrun got to be able to be used by not only OAuth2, but also Service Account.](#useserviceaccount)
0 commit comments