{"id":13403750,"url":"https://github.com/filipedeschamps/parse-google-docs-json","last_synced_at":"2025-04-10T03:53:55.812Z","repository":{"id":43357674,"uuid":"288839614","full_name":"filipedeschamps/parse-google-docs-json","owner":"filipedeschamps","description":"Authenticates with Google API and parse Google Docs to JSON or Markdown","archived":false,"fork":false,"pushed_at":"2022-03-06T01:07:45.000Z","size":37,"stargazers_count":160,"open_issues_count":3,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T03:53:48.944Z","etag":null,"topics":["api","google","google-docs","google-docs-api","google-docs-api-format-text","json","markdown"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filipedeschamps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-19T21:17:26.000Z","updated_at":"2025-02-25T20:40:52.000Z","dependencies_parsed_at":"2022-09-15T17:50:26.020Z","dependency_job_id":null,"html_url":"https://github.com/filipedeschamps/parse-google-docs-json","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipedeschamps%2Fparse-google-docs-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipedeschamps%2Fparse-google-docs-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipedeschamps%2Fparse-google-docs-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipedeschamps%2Fparse-google-docs-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filipedeschamps","download_url":"https://codeload.github.com/filipedeschamps/parse-google-docs-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154999,"owners_count":21056542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","google","google-docs","google-docs-api","google-docs-api-format-text","json","markdown"],"created_at":"2024-07-30T19:01:34.062Z","updated_at":"2025-04-10T03:53:55.793Z","avatar_url":"https://github.com/filipedeschamps.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Parse Google Docs JSON\n\nThis **Node.js** module authenticates with **Google API** and parse **Google Docs** to human-readable **JSON** or **Markdown** without the need to use cumbersome methods like exporting it in HTML via **Google Drive API** and then parse it back to other formats.\n\n# Why\n\nWhen you use **Google Docs API V1**, the [body](https://developers.google.com/docs/api/reference/rest/v1/documents#Body) that comes with the `documents.get` method is completely fragmented. It's a JSON that you need to recursively parse to get the document into human-readable format. For my luck, there's a Gatsby plugin that internally has this implementation already: [gatsby-source-google-docs](https://github.com/cedricdelpoux/gatsby-source-google-docs). So I've extracted this implementation into this module and exposed it with a **Service Authentication**. For more information about this type of authentication, follow this tutorial: [How to authenticate to any Google API](https://flaviocopes.com/google-api-authentication)\n\n# Warning\n\nThis module works like a charm, but it's for personal use, primarily. It will follow semantic version best practices, but will not have any automated tests in the short term.\n\n# How to use\n\n```js\nconst parseGoogleDocsJson = require(\"parse-google-docs-json\");\n\nasync function start() {\n  const parsed = await parseGoogleDocsJson({\n    documentId: \"1ymKw2OGcMfc02XdEEWdy22a_zUAlCxyN3P5Ab4c\",\n    clientEmail: \"service@iam.gserviceaccount.com\",\n    privateKey: \"-----BEGIN PRIVATE KEY...\",\n  });\n\n  console.log(parsed.toJson());\n  console.log(parsed.toMarkdown());\n}\n\nstart();\n```\n\n# Environment variables\n\n```\nclientEmail = process.env.PARSE_GOOGLE_DOCS_CLIENT_EMAIL\nprivateKey = process.env.PARSE_GOOGLE_DOCS_PRIVATE_KEY\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipedeschamps%2Fparse-google-docs-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilipedeschamps%2Fparse-google-docs-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipedeschamps%2Fparse-google-docs-json/lists"}