Wiki

Clone wiki

google-docs-simple-parser / Home

Google Docs Simple Parser

Google Docs Simple Parser (gdsp) is a simple JavaScript parser to create objects from Google Docs documents.

gdsp parses the complex object returned by Google and returns a simple array of objects with all the cell values.

This version of gdsp can parse:

  • spreadsheets exported as JSON cells (no empty cells allowed).
  • spreadsheets exported as TXT (tsv, tab separated values).

Spreadsheet format

The spreadsheet format is quite simple:

  • Each column is an attribute for an object.
  • The first row contains the attribute names.
  • Each row contains the data for an object.

IMPORTANT: No empty cells are allowed when using the JSON format! The parsing will fail if there are empty cells. If you need empty cells, use the TXT exporter.

Spreadsheet example

Suppose the following 3-row spreadsheet:

     -----------------------
     | name     | lastName |
     | Kilgoure | Trout    |
     | Billy    | Pilgrim  |
     -----------------------

gdsp will create an array of objects like this:

     [{name: "Kilgoure", lastName: "Trout"},
      {name: "Billy"   , lastName: "Pilgrim"}]

How to export my Google Docs Spreadsheet as JSON cells?

Read more at Google documentation.

Remember that gdsp does not allow empty cells when using this format!

How to export my Google Docs Spreadsheet as TXT?

  1. From the File menu, select Publish to the Web...
  2. Click Start publishing button.
  3. From the options combo, select TXT.

Read more at Google Support.

Demo spreadsheet and usage examples

There is a demo spreadsheet: https://docs.google.com/spreadsheet/ccc?key=0ApvTNPAOSjfTdHRFeEJRZzhlZnNjQnUwMjBqNmh6QVE

The file demo.html has some usage examples.

License

gdsp is distributed under the Mozilla Public License, version 2.0. The LICENSE file contains more information about the licesing of this product. You can also read more about the MPL at http://www.mozilla.org/MPL/2.0/FAQ.html

Contact us

Have any problems, ideas or suggestions? We are always glad to hear from you! Contact us at contacto@ideasagiles.com

Updated