会員登録(無料)
ログイン
Improve your skills, click here now!

[Google Spreadsheet] QUERY function | Query list Part 1 (SELECT clause)

You can extract data from a range with the QUERY function

The QUERY function “uses the query language of the Google Visualization API to query the entire data”.

=QUERY(data, query, [headers])

I’ve introduced it before, but I would like to try using other queries and actually using them.

This time , I would like to extract data from the Tokyo Metropolitan Open Data Catalog site using data from the Tokyo Metropolitan Wholesale Market Daily Report (planned sales volume, flowers).

SELECT * (select all columns)

You can use select to select a range.

=query(estimate_quantity_flower!A2:K,"select *")

All data extracted!

SELECT A (specific column selection)

Let’s say “select A” (select column A).

=query(estimate_quantity_flower!A2:K,"select A")

Only data in column A was extracted!

select A,B,C (select multiple columns)

When selecting multiple rows, separate the column symbols with “,” (comma).

=query(estimate_quantity_flower!A2:K,"select A,B,C")

Only the data in columns A, B and C were extracted!

[rml_read_more]

select C,B,A (replace the order of the columns)

To change the order of multiple columns, separate the column symbols with “, (comma)” and specify the columns in the order you want to sort.

=query(estimate_quantity_flower!A2:K,"select C,B,A")

Column data was extracted in the order of C column, B column, A column!

summary

By using the “query function” like this, you can extract data under various conditions! This time, I focused on the SELECT clause only. Next time, I would like to extract with various patterns of queries!

Please refer to it.