Skip to content

Commit

Permalink
add support for google docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marph91 committed Sep 29, 2024
1 parent 927f380 commit a547225
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 11 deletions.
15 changes: 15 additions & 0 deletions docs/formats/google_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This page describes how to convert notes from Google Docs to Markdown.

## General Information

- [Website](https://docs.google.com/)
- Typical extensions: `.zip`, `.tgz`

## Instructions

1. Export via [Google Takeout](https://takeout.google.com)
1. Select "Drive"
2. Select the folders you want to export
2. [Install jimmy](../index.md#installation)
3. Convert to Markdown. Example: `jimmy-cli-linux takeout-20240401T160556Z-001.zip --format google_docs`
4. [Import to your app](../import_instructions.md)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ nav:
- Dynalist: formats/dynalist.md
- Facebook: formats/facebook.md
- FuseBase: formats/fusebase.md
- Google Docs: formats/google_docs.md
- Google Keep: formats/google_keep.md
- Joplin: formats/joplin.md
- jrnl: formats/jrnl.md
Expand Down
19 changes: 10 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ If this app is useful for you, feel free to star it on [github](https://github.c

```mermaid
flowchart LR
A[App 1] -->|Backup| D
B[App 2] -->|Export| D
C[Filesystem] --> D
D(ZIP archive/JSON/folder) --> E
E{jimmy} --> F(Markdown + Frontmatter)
F -->|Import| G[Joplin]
F -->|Import| H[Obsidian]
F --> I[...]
F --> J[Editor, e. g. VSCode]
A[App 1] -->|Backup| M
B[App 2] -->|Export| M
C[...] --> M
D[Filesystem] --> M
M(ZIP archive/JSON/Folder) --> N
N{jimmy} --> O(Markdown + Frontmatter)
O -->|Import| P[Joplin]
O -->|Import| Q[Obsidian]
O --> R[...]
O --> S[Editor, e. g. VSCode]
```

1. Export/backup notes from your note application
Expand Down
22 changes: 22 additions & 0 deletions src/formats/google_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Convert Google Docs documents to the intermediate format."""

from pathlib import Path

import common
import converter
from converter import DefaultConverter


class Converter(converter.BaseConverter):
accepted_extensions = [".tgz", ".zip"]

def prepare_input(self, input_: Path) -> Path:
return common.extract_zip(input_)

def convert(self, file_or_folder: Path):
self.root_path = self.prepare_input(file_or_folder)

# see BaseConverter.convert_multiple()
docs_converter = DefaultConverter(self.format, self.output_folder)
docs_converter.root_notebook = self.root_notebook
docs_converter.convert(self.root_path / "Takeout/Drive")
2 changes: 1 addition & 1 deletion src/formats/google_keep.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class Converter(converter.BaseConverter):
accepted_extensions = [".zip", ".tgz"]
accepted_extensions = [".tgz", ".zip"]

def prepare_input(self, input_: Path) -> Path:
match input_.suffix.lower():
Expand Down
1 change: 1 addition & 0 deletions test/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def compare_dirs(dir1: Path, dir2: Path):
[["day_one/test_2/dayone-to-obsidian.zip"]],
[["day_one/test_3/Export-Tagebuch.zip"]],
[["dynalist/test_1/dynalist-backup-2024-04-12.zip"]],
[["google_docs/test_1/takeout-20240929T124909Z-001.zip"]],
[["google_keep/test_1/takeout-20240401T160556Z-001.tgz"]],
[["google_keep/test_2/takeout-20240920T140112Z-001.zip"]],
[["joplin/test_1/29_04_2024.jex"]],
Expand Down

0 comments on commit a547225

Please sign in to comment.