Generate JSON file from Google Docs with ArchieML
npm install grunt-docs-archieml --save
Dashboardand then click on
ENABLE APIb. Click on
DRIVE APIand if it’s not enabled just click on
Create credentials, select
oAuth client IDand then select
https://developers.google.com/oauthplaygroundas an authorized redirect URL
Step 1check all
Drive API v3
Use your own OAuth credentials
Step 1section on the left and click
Exchange authorization code for tokensand copy the generated refresh token.
.credentials.jsonand add the following with your info:
The file can be saved anywhere. Recommended that you save it in your home folder so that your your secret credentials are not uploaded with your project.
Grab the Google Doc ID of the ArchieML ready document
With the Google Doc open, go to File > Publish to web, click on
PUBLISHunder the Link section and copy the ID from the URL. The ID is in between the ‘d’ and ‘pub’ section of the URL.
Add the following within the
grunt.initConfig() and modify the options as needed.
credentialsdefaults to your home folder and will look for a .credentials.json file
docsIDhas no default
destdefaults to a directory named json
$ grunt gdocs
Run the command to generate the JSON file. The file name will be the title of your Google Doc (all lowercase with underscores).