суббота, 10 августа 2013 г.

PHP: How to get Google Drive spreadsheet

Task

We have: a spreadsheet at Google Drive.
We need: to get that spreadsheet as a PHP array.

CSV format seems to be a suitable one for this task, though it allows to download one sheet only.

One-liner

Wget should be installed for this to work:

Expanded solution

Alternatively, we can use cURL:

How to get spreadsheet URL

Spreadsheet can be either shared via secret link or published. In both cases you should add &output=csv. Also, you can add &gid=N to get Nth sheet.

References

Комментариев нет: