New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

parse-google-docs-json

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-google-docs-json

This Node.js module authenticates with Google API and parse Google Docs to human-readable JSON or Markdown.

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
decreased by-6.9%
Maintainers
1
Weekly downloads
 
Created
Source

Parse Google Docs JSON

This 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.

Why

When you use Google Docs API V1, the 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. 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

Warning

This 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.

How to use

const parseGoogleDocsJson = require("parse-google-docs-json");

async function start() {
  const parsed = await parseGoogleDocsJson({
    documentId: "1ymKw2OGcMfc02XdEEWdy22a_zUAlCxyN3P5Ab4c",
    clientEmail: "service@iam.gserviceaccount.com",
    privateKey: "-----BEGIN PRIVATE KEY...",
  });

  console.log(parsed.toJson());
  console.log(parsed.toMarkdown());
}

start();

Environment variables

clientEmail = process.env.PARSE_GOOGLE_DOCS_CLIENT_EMAIL
privateKey = process.env.PARSE_GOOGLE_DOCS_PRIVATE_KEY

Keywords

FAQs

Package last updated on 06 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc