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
- A Google Account
- Your Google Doc with text content with headers
- node > 6.0.0 (Optional)
- yarn (or npm latest) > 0.10.0 (Optional)
- Open your google doc document
- Click on "Tools" > "Script Editor..."
- Name your project something memorable
- Replace contents of code.gs with this file
- Click on Publish and select "Deploy as web app"
- Select new and type a version name (e.g 0.1.0) (or update existing)
- In "Execute the app as" select yourself
- In "Who has access to the app" Select "Anyone, even anonymous"
- Click Deploy or Update
- Click "Review Permissions", to Authorize application
- When you see a warning, Click "Advanced" and "Go to json-google-docs Demo"
- Review list of permissions required, and click "Allow"
- 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)
yarn add json-google-docs
const uri = ''const doc = uridoc
var JSONGoogleDocs =var uri = ''var doc = uridoc
var url = ''var doc = urldoc
There is a test function setup that you can change to include your own fields and make sure your form is setup correctly.
- Change the testData in test_get()
- Move to Run in the top menu)
- Click function test_get()
# Run unit testyarn test
# Create new versioned releaseyarn run release
You can see a demo for this: https://techcoop.github.io/json-google-docs/
You can see the original google docs here: https://docs.google.com/document/d/1bWzB8QWraOfoYG_ptIBTGz0aRWphbiXLvKWg-zs1gz4/edit
You can see the JSON source here: https://script.googleusercontent.com/macros/echo?user_content_key=hqAM2uUtmlnuSybtM-GbVnbqBG864jAwf7wPuMjLNY87kFc58orubUuGr2s4w_nU_2XbOUdnOhQYqydGFSerxTZcYg2lq4EUm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnKHUxXDtU9d-4s_ZDMMZ5puQfuxCLCTCap-xNYsg5JYoTjyvpSz_6jTgQHY_bPxQKPKfVnhjI6Uu&lib=Mb46ZgXAGNpXApDvE_4m9szZqqPiN-w-P
- TODO implement search or nested element fetching