Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/giovannicoppola/alfred-gsheets


https://github.com/giovannicoppola/alfred-gsheets

alfred alfred-workflow google-sheets productivity spreadsheets

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# alfred-gsheets

Inspired by `I-sheet-you-not`, this Workflow creates new Workflows to access individual Google Sheets with Alfred.

![](images/gsheets.gif)


Downloads

## 🚀Usage
1. Open a Google Sheet in your browser.
2. Launch `alfred-gsheets` via keyword (default: `gshe`) or hotkey
3. `alfred-gsheets` will check the frontmost page with one of three outcomes:
1. The website is not a Google Sheet ▶️ check URL
2. The website is a Google Sheet but you don't have the right permissions ▶️ review the `Setting up` section
3. The website is a Google Sheet and you have at least viewing privileges ▶️ go to step 4
4. `alfred-gsheets` will list the individual worksheets. Select one to generate a `alfred-gsheets` Workflow instance to browse that Sheet.
5. Once a new Workflow is created, ↩️ will lead you to its `Workflow Configuration`, where changes to keyword etc. can be made:
- `Header Row` (column headers). Row containing the column headers. Set this to 0 if no header.
- columns for Alfred's `Title` (required), `Subtitle` and `Arg`.
- Alternatively, a custom layout can be set as follows: up to three lines (for Title, Subtitle, and Arg), with layout text in quotes and column numbers in square brackets. For example:

```
Title: "College 🎓: [1]"
Subtitle: "City: [2]"
Arg: "URL: [3]"
```

- *Note:* if a custom layout is used, the Title, Subtitle and Arg fields will be ignored.
- `Append column`: If you have writing privileges on your Google Sheet (see `Setting up`), you can indicate a column to which append values via `alfred-gsheets` using a keyword (default: `[main workflow keyword]::append`, e.g. `uni::append`) or hotkey

### 🧮 New workflow: usage
- entering the main keyword (default: first three letters of the workflow name) will list sheet columns according to the Title, Subtitle, and Arg variables, or custom layout.
- If the argument is a URL, `Enter` ↩️ will open it in your browser.
- If not, `Enter` ↩️ will copy it to the clipboard

## Setting up ⚙️
*Note: this setup is more complex than the average workflow. I tried to document all the steps below, feel free to point to unclear steps or instructions. A screencast of the process is [here](https://github.com/giovannicoppola/alfred-gsheets/blob/main/images/googleAPIsetup.gif).*

Steps 1-7 are needed to access public Google Sheets. An additional step 8 is needed to access private Google Sheets.

### Setting up Google Sheets API credentials (required):

1. Log into your Google account
1. Go to the [Google Developers Console](https://console.developers.google.com/)
1. Using the `Select a project` dropdown menu, create a new project (or select an existing one).
1. Click on `+ ENABLE APIS AND SERVICES` at the top of the page, then select `Google Sheets API` for your project. Click on `ENABLE`
1. From the API Console, click `Credentials` in the sidebar, then click on `+ CREATE CREDENTIALS` at the top of the page and select `Service account` to create a new service account key
1. enter an account name (e.g. "MyAlfredAPI") and a description (e.g. "for Alfred Workflow")
2. in `Manage service accounts`, select `Keys` and create a new JSON key, which will be downloaded onto your computer. This key contains your account credentials.
3. Move that file to your preferred location, then enter the path to the file in `Key File` in `Workflow configuration`. This is required for the workflow to work.

### If the Google sheet is private
1. Copy the service account email address (go to `Manage service accounts`, hover over the email of your project, a copy icon will appear).
![](images/screenshot_email.png)
1. Share the private Google Sheet with the service account email address, granting it the appropriate access permissions.

# Changelog
- 2024-02-01: first release (version 0.1)

# Thanks
- [tutorial](https://www.makeuseof.com/tag/read-write-google-sheets-python/) on how to access google sheets via Python
- Icons from [Flaticon](www.flaticon.com)
- https://www.flaticon.com/free-icon/table-cell_6099818
- https://www.flaticon.com/free-icon/add-button_8246338
- https://www.flaticon.com/free-icon/spreadsheet_3919650

# Feedback 🧐

Feedback welcome! If you notice a bug, or have ideas for new features, please feel free to get in touch either here, or on the [Alfred](https://www.alfredforum.com) forum.