使用带有importRange()的查询 - "无法解析函数QUERY参数2的查询字符串:NO_COLUMNF"

时间:2015-06-07 18:15:32

标签: google-sheets

我尝试了很多排列并且不停地撞墙。为什么不做这项工作。

第1步,这有效:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/blablabla/edit#gid=blablabla","combined!A1:F10")

产地:

ga:year ga:month    ga:source   ga:medium   ga:campaign ga:goalCompletionsAll
2013    6   #3 Announcement of new titles   email   iPad title announcement 1
2013    6   (direct)    (none)  (not set)   3948
2013    6   0fb72887-fb60-4d86-b8e2-9990801bc83e    (not set)   wda 0
2013    6   1.1.1.1 referral    (not set)   0
2013    6   1.1.2.1 referral    (not set)   0
2013    6   10.122.101.1    referral    (not set)   0
2013    6   10.14.163.91:8080   referral    (not set)   0
2013    6   10.15.0.1   referral    (not set)   0
2013    6   10.173.0.1  referral    (not set)   0

到目前为止一切顺利。

我的实际数据集是数万条记录。我想最初在这个样本集上计算(*):

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/blablabla/edit#gid=blablabla","combined!A1:F10"),"SELECT COUNT(F)",1)

给出:

  

无法解析Function QUERY参数2的查询字符串:   NO_COLUMNF

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/blablabla/edit#gid=blablabla","combined!A1:F10"),"SELECT COUNT(*)",1)

给出:

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROREncountered "*" at line 1, column 14. Was expecting one of: "min" ... "max" ... "avg" ... "count" ... "sum" ... "no_values" ... "no_format" ... "is" ... "null" ... "year" ... "month" ... "day" ... "hour" ... "minute" ... "second" ... "millisecond" ... "with" ... "contains" ... "starts" ... "ends" ... "matches" ... "like" ... "now" ... "dateDiff" ... "quarter" ... "lower" ... "upper" ... "dayOfWeek" ... "toDate" ... <ID> ... <QUOTED_ID> ...

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/blablabla/edit#gid=blablabla","combined!A1:F10"),"SELECT COUNT F",1)

给出:

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROREncountered "F" at line 1, column 14. Was expecting one of: <EOF> "where" ... "group" ... "pivot" ... "order" ... "skipping" ... "limit" ... "offset" ... "label" ... "format" ... "options" ... "," ... "*" ... "+" ... "-" ... "/" ... "%" ... "(" ...

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/blablabla/edit#gid=blablabla","combined!A1:F10"),"SELECT COUNT('ga:goalCompletionsAll')",1)

给出:     无法解析函数QUERY参数2的查询字符串:PARSE_ERROREncountered&#34; \&#39; ga:goalCompletionsAll \&#39;&#34;在第1行,第14栏。期待以下之一:&#34; min&#34; ......&#34; max&#34; ......&#34; avg&#34; ...&#34;计数&#34; ...&#34;总和&#34; ......&#34; no_values&#34; ...&#34; no_format&#34; ......&#34;是&#34; ......&#34; null&#34; ...&#34;年&#34; ......&#34;月&#34; ...&#34; day&#34; ......&#34;小时&#34; ......&#34;分钟&#34; ......&#34;秒&#34; ......&#34;毫秒&#34; ......&#34;&#34; ......&#34;包含&#34; ......&#34;开始&#34; ......&#34;结束&#34; ......&#34;匹配&#34; ......&#34;喜欢&#34; ......现在&#34; ...&#34; dateDiff&#34; ......&#34;季度&#34; ......&#34;降低&#34; ...&#34;鞋面&#34; ...&#34; dayOfWeek&#34; ...&#34; toDate&#34; ...... ......

我还尝试了很多其他的事情。不断收到错误。

当我在相关工作表内并运行查询时,它可以工作。只有当我尝试导入它时才会导致问题。但是如果你看一下我写的第一个函数,我可以导入数据。

是什么给出了?

2 个答案:

答案 0 :(得分:1)

如果你没有使用它,请尝试使用Col6而不是F.当使用带有importRange的查询时,它需要列号,其中Col1是在导入范围中选择的第一列。

答案 1 :(得分:0)

尝试首先在工作表上执行Importrange,然后创建另一个执行查询的工作表。 这帮助了我。