Import
Summary
The Google Docs Import Pod imports contents of a Google document to a specified hierarchy in your selected vault as a note. It can parse all the headings, links, lists, tables, user-mentions and images present in the document.
The images are downloaded in the assets folder and are referenced from the note. User mentions are interpreted as a user tag and parsed as @firstname-lastname
The import config has additional options to import comments in the doc.
Workflow
There are several steps to using the gdoc import pod:
- Authentication
- Choosing Which Document To Import
- Choosing the Destination
Authentication
There are currently two ways to authenticate - through an OAuth workflow (currently in Beta) and a manual workflow.
OAuth Flow (Beta)
Note: This feature is currently in Beta and requires your Google Account to be onboarded to our service. If you're interested in testing out this feature, please contact us at support@dendron.so or on Discord.
After getting your Google Account onboarded with us, simply run the GDoc import pod and you'll be redirected to your browser to sign in with your Google Account. Once signed in, your credentials will be saved and you can run the Import Pod again to import your docs.
Manual Workflow
To communicate with the Google Docs, you'll need to manually obtain OAuth token with the right scopes. Follow the steps below to create a token. The scopes you require depends on the type of data you're trying to request, you can even select all and you are good to go.
- Go to Google Oauth2 Playground and select the
Google Docs API v1
with scope ashttps://www.googleapis.com/auth/documents
andhttps://www.googleapis.com/auth/drive
and click on Authorize APIs button. Authorize yourself by selecting your Google account from the oauth popup. - On Step 2 in Oauth2 Playground, click on exchange authorization code for tokens. Copy the access token, refresh token and store it in the Dendron gdoc import pod config file.
Choosing which Document to Import
The Pod will automatically query for documents on your Drive and provide you with a drop down list of documents for you to choose to import. Currently, only one file can be imported at a time. If it takes the engine too long to query for your documents (maybe if you have a lot of documents on your drive), then the operation will time out. In this case, you can manually enter the name of the document you want to import.
Choosing the Destination
The final prompt in the workflow asks for the destination location of the note to put the gdoc contents in. By default, the name of the document is populated. If you import this document repeatedly, then the destination will be pre-populated with the path you picked during the previous import.
Example
- config
src: gdoc
vaultName: vault
owner: dendronhq
accessToken: ***
refreshToken: ***
expirationTime: 1630569771.749
importComments: {enable: true, format: text}
confirmOverwrite: true
- Original
└── vault
└── projects
├─one.md
├─two.md
- After
└── vault
├── projects.one.md
├── projects.two.md
└── gdoc.topic.dendron
- Imported Doc
---
title: Dendron
documentId: ***
revisionId: ***
CommentsUpdated: true
---
## Dendron
Dendron is an **open-source**, **local-first**, **Markdown-based**, **note-taking** tool built on top of [VS Code](https://code.visualstudio.com/). Like most such tools, Dendron supports all the usual features you would expect like :
- Tagging
- Backlink
- graph view
- split panes.
Dendron helps you get notes back out and works better the more notes you have.
### Comments
- John Doe: @adam can we add use cases in the note
replies to this comment:
- Adam Smith: Yes, added.
Configuration
src
- description: "Where to import from"
- type: "string" as const
- required: true
vaultName
- description: "name of vault to import into"
- type: "string" as const
- required: true
concatenate
- description: "whether to concatenate everything into one note"
- type: "boolean"
- default: false
When importing, you can either import everything from source as multiple files or concatenate it all together as one file
frontmatter
- description: "frontmatter to add to each note"
- type: "object"
You can add custom frontmatter to notes as you import them. This is useful for example, when you want to set custom publishing options for imported notes
fnameAsId
- description: "use the file name as the id"
- type: "boolean"
By default, random uuids are generated as the id for each imported note. This makes the id equivalent to that of the filename
destName
- description: "If
concatenate
option is set, this is the name of the destination path - type: "string" as const
Additional Google Doc Pod Specific Configurations:
accessToken
- description: Google Doc personal access token
- type: string
- required: true
refreshToken
- description: Google Doc refresh token. This will be used to automatically refresh the access token once it passes its expiration time.
- type: string
- required: false
expirationTime
- description: Expiration Time of the Access Token. It is not necessary to manually modify this value.
- type: "number"
- required: false
importComments
-
description: import comments from the doc in text or JSON format
-
required: false
-
type: object
-
example: : {enable: true, format: text}
-
enable type: boolean default: false required: true
-
format type: string default: json accepted formats: json/text
confirmOverwrite
- description: prompt user for confirmation before overwriting existing note
- type: boolean
- required: false
- default: true
Backlinks