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

https://github.com/robiningelbrecht/google-spreadsheets-improved-query

Use column names in Google Spreadsheets QUERY()
https://github.com/robiningelbrecht/google-spreadsheets-improved-query

Last synced: 6 days ago
JSON representation

Use column names in Google Spreadsheets QUERY()

Awesome Lists containing this project

README

          

# Google spreadsheets improved query

Use column names in your Google Spreadsheets QUERY() functions.
This script is based on this [YouTube](https://www.youtube.com/watch?v=clq7WlC2whk) tutorial.

Script ID: `1BZyZAV5h_cgqvMh0oU86PiKC_GK6yMPPk74eDmQjZ2Ijrhm-si3BwUxd`

## Usage

```
=QUERY(A1:H, SELECT("SELECT SUM([amount]) WHERE [amount] > 0 LABEL SUM([amount]) ''", 'A1:Z1), 0)
```

`SELECT` expects 2 parameters:
- Your query
- Range of the column names (should be exactly one row)

### Query placeholders

Each column name (= placeholder) needs to be surrounded with `[ ]` and can be targeted
with the [camelCase](https://en.wikipedia.org/wiki/Camel_case) version of the names in the "header row":


Column name
camelCase field


id
[id]


Purchased On
[purchasedOn]


Amount
[amount]

## Adding the library to your project

The 'SELECT` function is made available as a script library. Follow [these steps](https://developers.google.com/apps-script/guides/libraries#add_a_library_to_your_script_project) to add it to your project.