What it does
- Walks each folder and its subfolders.
- Exports Google Docs as Markdown, or as plain text when Markdown export is not available.
- Downloads
.md,.markdownand.txtfiles. - Skips everything else.
- Writes each document to
raw/gdrive/<modified date>-<name>.mdwith its Drive link.
drive.readonly scope.
Credentials
Set one of these in the environment.- Service account
- OAuth client
- In Google Cloud, enable the Drive API and create a service account with a JSON key.
- Share each Drive folder with the service account’s email address.
- Install the extra and point to the key file:
Revisions
Sources are never changed after import, so each version of a document is its own source.
A path that was once given to a source is never given to a different one, so existing citations keep pointing at the same text.