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: docs/source/how_to/gsheets_setup.md
+46-15
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,43 @@ This guide explains how to set up Google Sheets to process URLs automatically an
6
6
2. Setting up a service account so Auto Archiver can access the sheet
7
7
3. Setting the Auto Archiver settings
8
8
9
-
### 1. Setting up your Google Sheet
10
9
11
-
Any Google sheet must have at least *one* column, with the name 'link' (you can change this name afterwards). This is the column with the URLs that you want the Auto Archiver to archive.
12
-
Your sheet can have many other columns that the Auto Archiver can use, and you can also include any additional columns for your own personal use. The order of the columns does not matter, the naming just needs to be correctly assigned to its corresponding value in the configuration file.
10
+
## 1. Setting up a Google Service Account
13
11
14
-
We recommend copying [this template Google Sheet](https://docs.google.com/spreadsheets/d/1NJZo_XZUBKTI1Ghlgi4nTPVvCfb0HXAs6j5tNGas72k/edit?usp=sharing) as a starting point for your project, as this matches the default column names.
12
+
Once your Google Sheet is set up, you need to create what's called a 'service account' that will allow the Auto Archiver to access it.
13
+
14
+
To do this, you can either:
15
+
* a) follow the steps in [this guide](https://gspread.readthedocs.io/en/latest/oauth2.html) all the way up until step 8. You should have downloaded a file called `service_account.json` and should save it in the `secrets/` folder
16
+
* b) run the following script to automatically generate the file:
This uses gcloud to create a new project, a new user and downloads the service account automatically for you. The service account file will have the name `service_account-XXXXXXX.json` where XXXXXXX is a random 16 letter/digit string for the project created.
21
+
22
+
```{note}
23
+
To save the generated file to a different folder, pass an argument as follows:
Once you've downloaded the file, you can save it to `secrets/service_account.json` (the default name), or to another file and then change the location in the settings (see step 4).
31
+
32
+
Also make sure to **note down** the email address for this service account. You'll need that for step 3.
33
+
34
+
```{note}
35
+
The email address created in this step can be found either by opening the `service_account.json` file, or if you used b) the `generate_google_services.sh` script, then the script will have printed it out for you.
We recommend copying [this template Google Sheet](https://docs.google.com/spreadsheets/d/1NJZo_XZUBKTI1Ghlgi4nTPVvCfb0HXAs6j5tNGas72k/edit?usp=sharing) as a starting point for your project, as this matches all the columns required.
44
+
45
+
But if you like, you can also create your own custom sheet. The only columns required are 'link', 'archive status', and 'archive location'. 'link' is the column with the URLs that you want the Auto Archiver to archive, the other two record the archival status and result.
15
46
16
47
Here's an overview of all the columns, and what a complete sheet would look like.
17
48
@@ -46,21 +77,18 @@ In this example the Ghseet Feeder and Gsheet DB are being used, and the archive
46
77
47
78

48
79
49
-
We'll change the name of the 'Destination Folder' column in step 3.
80
+
We'll change the name of the 'Destination Folder' column in the Step 4a.
50
81
51
-
## 2. Setting up your Service Account
82
+
## 3. Share your Google Sheet with your Service Account email address
52
83
53
-
Once your Google Sheet is set up, you need to create what's called a 'service account' that will allow the Auto Archiver to access it.
54
-
55
-
To do this, follow the steps in [this guide](https://gspread.readthedocs.io/en/latest/oauth2.html) all the way up until step 8. You should have downloaded a file called `service_account.json` and shared the Google Sheet with the log 'client_email' email address in this file.
84
+
Remember that email address you copied in Step 1? Now that you've set up your Google sheet, click 'Share' in the top
85
+
right hand corner and enter the email address. Make sure to give the account **Editor** access. Here's how that looks:
56
86
57
-
Once you've downloaded the file, save it to `secrets/service_account.json`
87
+

58
88
59
-
## 3. Setting up the configuration file
89
+
## 4. Setting up the configuration file
60
90
61
-
Now that you've set up your Google sheet, and you've set up the service account so Auto Archiver can access the sheet, the final step is to set your configuration.
62
-
63
-
First, make sure you have `gsheet_feeder_db` set in the `steps.feeders` section of your config. If you wish to store the results of the archiving process back in your Google sheet, make sure to also set the `ghseet_db` settig in the `steps.databases` section. Here's how this might look:
91
+
The final step is to set your configuration. First, make sure you have `gsheet_feeder_db` set in the `steps.feeders` section of your config. If you wish to store the results of the archiving process back in your Google sheet, make sure to also put `gsheet_feeder_db` setting in the `steps.databases` section. Here's how this might look:
64
92
65
93
```{code} yaml
66
94
steps:
@@ -75,12 +103,15 @@ steps:
75
103
Next, set up the `gsheet_feeder_db` configuration settings in the 'Configurations' part of the config `orchestration.yaml` file. Open up the file, and set the `gsheet_feeder_db.sheet` setting or the `gsheet_feeder_db.sheet_id` setting. The `sheet` should be the name of your sheet, as it shows in the top left of the sheet.
76
104
For example, the sheet [here](https://docs.google.com/spreadsheets/d/1NJZo_XZUBKTI1Ghlgi4nTPVvCfb0HXAs6j5tNGas72k/edit?gid=0#gid=0) is called 'Public Auto Archiver template'.
77
105
106
+
If you saved your `service_account.json` file to anywhere other than the default location (`secrets/service_account.json`), then also make sure to change that now:
107
+
78
108
Here's how this might look:
79
109
80
110
```{code} yaml
81
111
...
82
112
gsheet_feeder_db:
83
113
sheet: 'My Awesome Sheet'
114
+
service_account: secrets/service_account-XXXXX.json # or leave as secrets/service_account.json
84
115
...
85
116
```
86
117
@@ -90,7 +121,7 @@ You can also pass these settings directly on the command line without having to
90
121
91
122
Here, the sheet name has been overridden/specified in the command line invocation.
92
123
93
-
### 3a. (Optional) Changing the column names
124
+
### 4a. (Optional) Changing the column names
94
125
95
126
In step 1, we said we would change the name of the 'Destination Folder'. Perhaps you don't like this name, or already have a sheet with a different name. In our example here, we want to name this column 'Save Folder'. To do this, we need to edit the `ghseet_feeder_db.column` setting in the configuration file.
96
127
For more information on this setting, see the [Gsheet Feeder Database docs](../modules/autogen/feeder/gsheet_feeder_db.md#configuration-options). We will first copy the default settings from the Gsheet Feeder docs for the 'column' settings, and then edit the 'Destination Folder' section to rename it 'Save Folder'. Our final configuration section looks like:
Copy file name to clipboardExpand all lines: src/auto_archiver/modules/gsheet_feeder_db/__manifest__.py
+9-5
Original file line number
Diff line number
Diff line change
@@ -70,10 +70,14 @@
70
70
- Skips redundant updates for empty or invalid data fields.
71
71
72
72
### Setup
73
-
- Requires a Google Service Account JSON file for authentication, which should be stored in `secrets/gsheets_service_account.json`.
74
-
To set up a service account, follow the instructions [here](https://gspread.readthedocs.io/en/latest/oauth2.html).
75
-
- Define the `sheet` or `sheet_id` configuration to specify the sheet to archive.
76
-
- Customize the column names in your Google sheet using the `columns` configuration.
77
-
- The Google Sheet can be used soley as a feeder or as a feeder and database, but note you can't currently feed into the database from an alternate feeder.
73
+
1. Requires a Google Service Account JSON file for authentication.
74
+
To set up a service account, follow the instructions in the [how to](https://auto-archiver.readthedocs.io/en/latest/how_to/gsheets_setup.html),
2. Create a Google sheet with the required column(s) and then define the `sheet` or `sheet_id` configuration to specify this sheet.
80
+
3. Customize the column names in your Google sheet using the `columns` configuration.
81
+
4. The Google Sheet can be used solely as a feeder or as a feeder and database, but note you can't currently feed into the database from an alternate feeder.
0 commit comments