QUERY current month in google spreadsheet

时间:2016-10-20 13:13:57

标签: javascript google-sheets-api

Quite simple question: I want a query that filters the current month, I got this one working:

=query(Sheet1!A9:F; "select sum(D) where A >= date '2016-10-01' and A < date '2016-11-01'"; 0)

I need to get sth like

(...) where A >= "'Year(Today())'-'Month(Today())'-01" (...)

but that doesn't work. :/

2 个答案:

答案 0 :(得分:0)

尝试使用大写的"TODAY()"代替&#34;今天()&#34;。我在此google forum中读到此查询语句区分大小写。

答案 1 :(得分:0)

这将查询从当月 1 号到当月最后一天的所有数据。

A >= date '"&text(EOMONTH(TODAY(),-1)+1,"yyyy-mm-dd")&"' and A <= date '"&text(EOMONTH(TODAY(),),"yyyy-mm-dd")&"'