Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including json-google-docs with all npm packages installed. Try it out:

var jsonGoogleDocs = require("json-google-docs")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

json-google-docs v0.2.1

Uses Google Apps Scripts with Google Docs to provide a document tree in JSON exposed on a GET URL for integration into anything.


Maintenance Status NPM version Travis build

Uses Google Apps Scripts with Google Docs to provide a document tree in JSON exposed on a GET URL for integration into anything.

Warning: This is should be considered extremely experimental


  1. A Google Account
  2. Your Google Doc with text content with headers
  3. node > 6.0.0 (Optional)
  4. yarn (or npm latest) > 0.10.0 (Optional)


Google Scripts

  1. Open your google doc document
  2. Click on "Tools" > "Script Editor..."
  3. Name your project something memorable
  4. Replace contents of with this file
  5. Click on Publish and select "Deploy as web app"
  6. Select new and type a version name (e.g 0.1.0) (or update existing)
  7. In "Execute the app as" select yourself
  8. In "Who has access to the app" Select "Anyone, even anonymous"
  9. Click Deploy or Update
  10. Click "Review Permissions", to Authorize application
  11. When you see a warning, Click "Advanced" and "Go to json-google-docs Demo"
  12. Review list of permissions required, and click "Allow"
  13. Copy and paste URL (note: if you're logged into multiple Google accounts you'll have to manually remove "/u/0" or similar from the URL to avoid errors)

NPM package

yarn add json-google-docs



import { Document } from 'json-google-docs'

const uri = ''
const doc = new Document(uri)

doc.fetch().then(() => {


var JSONGoogleDocs = require('json-google-docs')
var uri = ''
var doc = new JSONGoogleDocs.Document(uri)

doc.fetch().then(function() {


<script src="json-google-docs.js"></script>
var url = ''
var doc = new JSONGoogleDocs.Document(url)

doc.fetch().then(function() {


Google Scripts

There is a test function setup that you can change to include your own fields and make sure your form is setup correctly.

  1. Change the testData in test_get()
  2. Move to Run in the top menu)
  3. Click function test_get()

Client library

# Run unit test
yarn test


# Create new versioned release
yarn run release



You can see a demo for this:

You can see the original google docs here:

You can see the JSON source here:


  • TODO implement search or nested element fetching



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free