mbostock/d3 — pull request #702 by tcha-tcho (2012-07-06 06:50:42+00:00)
Title: Add Google Spreadsheet support to D3

# Google Spreadsheet

Hi Mr. Bostock,

First I would like to thank you for your beautiful code. It is truly a work of art.

### The Problem
I work for a major Brazilian newspaper (Estado) and others may have the same problem as me. Large companies do not allow changing the header of the server to be able to CORS, not without months of meetings. This can be a bit stressful. Sometimes we just want to create a view with few data and be able to do maintenance on the data from time to time.

### The suggestion
I agree that in general terms is not a good idea to use JSONP. But in the case of GDocs maybe we could make an exception. This would allow, for example, that the examples included in the package to operate without requiring a server. Great advantage for beginners. :)

### About the change
I wrote a first implementation of how this might work. It groups the two main ways that google allows to download data from the tables. Via feeds and SQL query. Includes including support for SQL (https://developers.google.com/chart/interactive/docs/querylanguage). So the developer does not need to download the entire table for viewing. That first implementation has less than 50 lines, but I will try to reduce more.

### Requirements
The table must be configured as public. The first row of the table must have the column names.

#### Restrictions
Google Spreadsheet does not allow more than 20MB or 400k cells. So this strategy does not replace a good database.

## Use
```javascript
d3.gdocs ({
url: "", //url and table key
sql: "", //table selection
as_feed: false //strategy used to download data
}, function (data) {
//where magic happens
})
```
### Security
The URL is disassembled, reassembled and parsed with a single callback enabled and it will runs within the D3

### Testing
Using the technique of late-loading. The D3 uses the libraries that let you test it?

**TO-DO** *Include support for choose specific Sheets on table*

I hope that this addition can be useful

Thank you very much

Tcha-Tcho