Dagg Nabbit
Dagg Nabbit

Reputation: 76766

Where is the YQL documentation for queries performed against remote CSVs?

I need to fetch some data from a Google spreadsheet in a client-side web app, and I thought YQL would be a good fit, since it can grab the CSV data from Google and convert it to JSONP. I've pieced together some YQL that mostly works from various blog posts and gists and things:

select * from csv 
where url="https://docs.google.com/spreadsheet/pub?key=XXXX&output=csv" 
and columns="foo,bar,blah"

This works nicely, but I'd like to know what else I can do with it. I'm wondering, for example, if I can set up an alias for the CSV to use in a more complex query, or if I can automatically have it treat the first row as column names. I've been looking through the YQL guide, but can't find any mention of the csv "table," the url or columns "fields," or anything related.

Can someone provide a link to some definitive resource on querying remote CSVs with YQL?

Upvotes: 0

Views: 210

Answers (1)

BrianC
BrianC

Reputation: 10721

The "documentation" for the CSV table in YQL is pretty lightweight. It's viewable in the YQL console as:

desc csv

There you'll see the required url field and optional charset and columns. This is a really simple table, with the most flexibility coming from being able to choose the columns to output (the first row of data is assumed to include column headings).

If you want to do more than the base table offers, you could create an open table. This YQL team blog post shows an example of starting with a "select * from csv" call, then manipulating the results with JavaScript:

YQL Blog: Getting stock information with YQL and open data tables

Upvotes: 1

Related Questions