DeepAgent

Google Docs

Simplified Google Docs API.

  • package: @deepagent/google-docs
  • exports: class GoogleDocsClient, namespace googleDocs
  • source
  • google docs docs

Install

npm install @deepagent/google-docs googleapis @google-cloud/local-auth
yarn add @deepagent/google-docs googleapis @google-cloud/local-auth
pnpm add @deepagent/google-docs googleapis @google-cloud/local-auth

Example Usage

import { GoogleDriveClient } from '@deepagent/google-drive'
import { authenticate } from '@google-cloud/local-auth'
import { google } from 'googleapis'

// (in a real app, store these auth credentials and reuse them)
const auth = await authenticate({
  scopes: ['https://www.googleapis.com/auth/documents.readonly'],
  keyfilePath: process.env.GOOGLE_CREDENTIALS_PATH
})
const docs = google.docs({ version: 'v1', auth })
const client = new GoogleDocsClient({ docs })

const document = await client.getDocument({ documentId: 'TODO' })
console.log(document)