ikariw
ikariw

Reputation: 353

Using Google API to Query Date in Spreadsheet

I have a google sheet that looks something like:

date        title  quantity
01/01/2015  t1     1
02/01/2015  t2     5

I am trying to write a query to return a row using a ListQuery. It works for strings or integers e.g.

listQuery.SpreadsheetQuery = "title=\"t1\""; 
listQuery.SpreadsheetQuery = "quantity=5"; 

However, when I try to do the same thing with the date column it doesn't match anything. I've tried a number of different ways e.g.

listQuery.SpreadsheetQuery = "date=\"01/01/2015\""; 
listQuery.SpreadsheetQuery = "date=01/01/2015"; 
listQuery.SpreadsheetQuery = "date=new Date(2015,1,1)";

but none of them return a result. Does anyone know how I can query a row based on a cell containing a date?

Upvotes: 1

Views: 670

Answers (1)

ikariw
ikariw

Reputation: 353

Just in-case someone else has the same issue, after some playing around with this I discovered the date in the query needs to be formatted as yyyy-MM-dd (regardless of how the date is formatted in the spreadsheet) e.g.

listQuery.SpreadsheetQuery = "date=2015-01-05";

Upvotes: 2

Related Questions