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
Copy file name to clipboardExpand all lines: .github/README.md
+28-5Lines changed: 28 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Read how this project was started [here](http://grahamearley.website/blog/2017/1
19
19
As of **v27**, this project has been updated to use the [GAS V8 runtime](https://developers.google.com/apps-script/guides/v8-runtime) with [Typescript](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html)! This introduces a number of [breaking changes](#breaking-changes).
20
20
21
21
## Installation
22
-
In the Google online script editor, select the `Resources` menu item and choose `Libraries...`. In the "Add a library" input box, enter `1VUSl4b1r1eoNcRWotZM3e87ygkxvXltOgyDZhixqncz9lQ3MjfT1iKFw` and click "Add." Choose the most recent version number.
22
+
In the Google online script editor, select the `Resources` menu item and choose `Libraries...`. In the "Add a library" input box, enter **`1VUSl4b1r1eoNcRWotZM3e87ygkxvXltOgyDZhixqncz9lQ3MjfT1iKFw`** and click "Add." Choose the most recent version number.
23
23
24
24
25
25
## Quick start
@@ -34,14 +34,33 @@ To make a service account,
34
34
3. For your service account's role, choose `Datastore > Cloud Datastore Owner`.
35
35
4. Check the "Furnish a new private key" box and select JSON as your key type.
36
36
5. When you press "Create," your browser will download a `.json` file with your private key (`private_key`), service account email (`client_email`), and project ID (`project_id`). Copy these values into your Google Apps Script — you'll need them to authenticate with Firestore.
37
+
6.**[Bonus]** It is considered best practice to make use of the [Properties Service](https://developers.google.com/apps-script/guides/properties) to store this sensitive information.
37
38
38
-
#### Create a test document in Firestore from your script
39
+
#### Configurating Firestore instance from your script
39
40
Now, with your service account client email address `email`, private key `key`, project ID `projectId`, we will authenticate with Firestore to get our `Firestore` object. To do this, get the `Firestore` object from the library:
Alternatively, using [Properties Service](https://developers.google.com/apps-script/guides/properties) <ins>once data is already stored</ins> in the service with **"client_email"**, **"private_key"**, and **"project_id"** property names:
56
+
```javascript
57
+
constprops=PropertiesService.getUserProperties(); // Or .getScriptProperties() if stored in Script Properties
0 commit comments