Skip to content
jauderhoPublic

About

Export Quip documents to Markdown (and optionally import them into Apple Notes)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

quip2md

Bulk-export a personal Quip account to Markdown, mirroring the account's folder structure on disk. Built ahead of Quip's March 2027 retirement so a personal account's documents survive as plain Markdown files instead of being locked in Quip. An optional second step imports that Markdown backup into Apple Notes (macOS only), so the migration path is Quip → Markdown backup (export) → Apple Notes (import-notes), with export/ remaining the durable, full-fidelity archive either way.

Requirements

  • Python 3.14+
  • uv

Setup

git clone <this repo>
cd quip2md
uv sync

Generate a personal API token at https://quip.com/dev/token and put it in a .env file in the project root:

QUIP_TOKEN=your-token-here

The token is read from QUIP_TOKEN in the process environment or .env (environment wins if both are set) and is never logged or printed. Personal Quip tokens expire; if a run fails with a 400/401 "invalid or expired" error, mint a new token at the link above and update .env.

Usage

uv run quip2md export

Run --dryrun first on a new account to sanity-check the folder tree before fetching anything:

uv run quip2md export --dryrun --verbose

Flags

All flags are under the export subcommand.

Flag Effect
--output DIR Directory to write the exported Markdown tree into. Defaults to ./export.
--dryrun Walk the account's folder tree and print the would-be output tree with per-folder thread counts. Makes no thread-HTML or blob requests and writes nothing to disk or to the manifest.
--verbose, -v Enable step-level DEBUG logging. Silent (warnings and above only) by default.
--force Re-export every thread even if the manifest says it's unchanged since the last run.
--include-chats Also export CHAT-type threads. Skipped by default — see AGENTS.md/PLAN.md.
--only THREAD_ID Restrict the export to the given thread id. Repeatable to export several specific threads (useful for a scoped test run before exporting the whole account).

What you get

  • export/<Quip folder path>/<sanitized title>.md — one Markdown file per document/spreadsheet, in a tree that mirrors the Quip account's folders. Filename collisions within a folder get (2), (3) suffixes.
  • Each .md file has YAML frontmatter: quip_id, quip_url, title, created, updated, exported.
  • _assets/<thread_id>/ next to each document holds its downloaded images.
  • Spreadsheets are converted to a Markdown table; when a table is too wide or complex to convert cleanly, a fidelity-preserving .xlsx backup is written alongside the .md file.
  • .quip2md/state.json — the resume manifest (thread id -> output path, update timestamp, export time). Do not delete this unless you want the next run to re-export everything.
  • .quip2md/last_run.json — a report of the most recent run (counts of exported/skipped/failed threads, blobs downloaded, elapsed time).

Resume / incremental behavior

Every run records each exported thread's Quip updated_usec in .quip2md/state.json. On the next run, a thread is skipped if its updated_usec hasn't changed since the manifest was written — even though its metadata is still fetched to check for changes. Use --force to re-export everything regardless of the manifest.

If the export is interrupted with Ctrl-C, the process exits with status 130. The manifest has already been flushed to disk at that point, so re-running the exact same command resumes from where it left off rather than starting over.

Time expectations

Measured on a personal account with 492 threads:

  • Full export: ~57 seconds, ~35 batched API requests, 29 images downloaded, zero failures.
  • Immediate re-run (nothing changed): ~14 seconds — every thread is skipped-unchanged, but metadata is still fetched for all of them to detect changes. Up to 3 batch requests run at once.

The client self-throttles to 80% of the observed per-minute rate limit (50 requests/minute per personal token) and adapts to the X-RateLimit-* response headers, so you never need to handle 429s yourself. For rough sizing on a larger account: at ~40 effective requests/minute and roughly 15 threads fetched per batched request, expect on the order of a few minutes per thousand threads.

Import into Apple Notes

Once you have an export/ tree, import it into Apple Notes.app:

uv run quip2md import-notes

Run --dryrun first to sanity-check the scan before touching Notes:

uv run quip2md import-notes --dryrun --verbose

import-notes is a purely offline operation over --source (default ./export) — it never reads QUIP_TOKEN or .env.

Flags

All flags are under the import-notes subcommand.

Flag Effect
--source DIR Directory containing the Markdown tree an earlier quip2md export run wrote. Defaults to ./export.
--local Target the "On My Mac" Notes account instead of the default account (usually iCloud). Only valid with --writer applescript; rejected (exit 2) with the markdown and enex writers, which always import into the default account.
--dryrun Scan and convert every source under --source, printing per-folder note counts; makes zero Notes automation calls and writes no .quip2md/notes_state.json.
--verbose, -v Enable step-level DEBUG logging. Silent (warnings and above only) by default.
--writer {markdown,enex,applescript} How notes reach Notes. Defaults to markdown on Notes 4.13 (macOS 27) and later, otherwise enex. See Import writers. An explicit markdown on older Notes is rejected (exit 2).
--force Re-import every note even if the state file says it's unchanged since the last run. With --writer markdown or enex this creates a second note per document; the previous copy is recorded as superseded and left in Notes for you to delete.
--only KEY Restrict the import to one note: a Quip thread id (from a source file's quip_id frontmatter), or, for a file without that frontmatter, its path:<relative/posix/path> key. Repeatable.
--enex-file PATH Where to write the Evernote archive. Defaults to .quip2md/quip2md.enex.
--adopt-landing FOLDER Resume an import whose notes reached Notes but were never filed, e.g. one that failed after you clicked Import. Imports nothing; files the notes already sitting in the named landing folder and records them in the state file. For a Markdown import, name the nested folder as "Imported Notes/quip2md-markdown-<stamp>". Use this instead of re-running, which would import a second copy of every document. Rejected with --writer applescript.
--no-fallback On a stalled Markdown import (no new note for 3 minutes), do not quit Notes or re-route the remaining documents through the archive; the stalled import waits for the full 15-minute timeout and the documents still missing are reported as failed. By default the run quits and relaunches Notes and re-imports the remaining documents through an Evernote archive.
--workers N Number of processes used to render Markdown to ENML for the archive (markdown and enex writers). Defaults to the CPU count capped at 6 (measured optimum on a 4P+4E Apple Silicon machine; a homogeneous x86-64 box may benefit from more). 1 renders in-process. Output is byte-identical at any setting.
--auto-confirm Click the Import button on Notes' confirmation sheet automatically, so a Markdown import needs no one at the keyboard. Needs Accessibility permission (see below), checked before anything is imported; if it is missing the run stops with exit 2. macOS English UI only. Does nothing with --dryrun. Off by default; rejected with --writer applescript.
--indent-checklists After the import, drive the Notes editor to restore nested checklist levels in notes that came through the archive. Needs Accessibility permission (see below) and changes each touched note's modification date. Off by default; rejected with --writer applescript.

macOS requirement and permissions

import-notes automates Notes.app via AppleScript/osascript and only runs on macOS. It needs two different macOS privacy permissions, and they are not the same grant — having one does not imply the other. Both are granted to whichever application runs quip2md (your terminal: Terminal, iTerm, Ghostty, VS Code…), not to quip2md itself.

Permission Where Needed for Symptom if missing
Automation → Notes System Settings → Privacy & Security → Automation → your terminal → Notes Every import. Granted by clicking OK on the one-time "… wants to control Notes" prompt. Import fails immediately; osascript reports "Not authorized to send Apple events".
Accessibility System Settings → Privacy & Security → Accessibility → add and enable your terminal --indent-checklists and --auto-confirm only. Both are UI scripting: the first drives the Notes editor's Format menu, the second clicks Notes' Import sheet. --indent-checklists: the pass refuses to start and prints how to fix it; the import itself is unaffected. --auto-confirm: the run stops before it imports anything (exit 2) and prints how to fix it.

The Accessibility grant is the one people miss, because the import works fine without it. There is no prompt for it in a non-interactive run — add the terminal to the list yourself, restart the terminal, then re-run. If the terminal was already listed, toggle it off and on again after upgrading it, since the grant is tied to the binary.

Notes asks for confirmation when it imports a Markdown folder (current Notes imports an archive without asking). Click Import on that sheet, or pass --auto-confirm to have quip2md click it. That is Notes' confirmation, not a permission.

What lands in Notes

  • A single top-level Quip folder in the target account, with the rest of the tree mirrored underneath it exactly as it appears under export/.
  • One note per source Markdown file, converted from its frontmatter + body. Each note starts with the document title and a Source: link to the original Quip document.
  • With the markdown writer, each note keeps the Quip document's creation and modification dates.
  • Images embed as real inline attachments (not links). Documents with images always go through the archive for this reason.

Re-run / update behavior

State lives in .quip2md/notes_state.json (thread id/path key -> note id + source hash). Re-running the same command:

  • Skips notes whose source hasn't changed since the last run — no duplicates are created. With the markdown and enex writers, a run in which everything is unchanged writes nothing and never opens Notes at all.
  • Handles a changed source differently per writer:
    • applescript updates the note in place (same note, same id).
    • markdown and enex import a second note: Notes' importer cannot replace an existing note, and rewriting the body would destroy exactly the links and checklists this writer exists to preserve. The new note takes over the state entry, the old note's id is recorded under superseded_note_ids, and the run ends with a warning telling you how many stale copies are still in Notes. Nothing is ever deleted for you — delete the old copies by hand.
  • --force re-pushes every note regardless of the state file (with markdown or enex, that means a duplicate of every note, each one superseding its predecessor).

If interrupted with Ctrl-C, the process exits with status 130. State is flushed to disk per folder, so re-running the same command resumes safely without duplicating notes already imported.

Import writers

import-notes has three writers. --writer markdown is the default where Notes can import Markdown (Notes 4.13, macOS 27 and later); --writer enex is the default elsewhere.

markdown (default on Notes 4.13+) keeps both of every document's dates and its nested checklists. Each document without an image is staged as a Markdown file whose birth time and modification time are set to the Quip document's created and updated timestamps; Notes' Markdown importer takes the note's creation and modification dates from them and builds checklists natively nested, so no indentation pass is needed. Two kinds of document stay on the enex route, because the Markdown importer loses content from them: documents with images (it never embeds an image, only links to it) and documents with a URL inside a table (it empties that cell and every cell after it). The whole staging folder (.quip2md/quip2md-markdown-<UTC timestamp>, replaced on the next run) imports after one confirmation (click Import, or pass --auto-confirm); current Notes imports the archive without asking. Notes places the staging folder inside an Imported Notes folder; the run finds it there by its unique name, files its notes under Quip, and leaves the empty folders behind (see Cleaning up after an import). One limitation: the Markdown importer makes every line of a multi-line list item into its own item, so such an item arrives as several checkboxes; no text is lost.

enex renders every document that has changed since the last run into one Evernote archive and hands it to Notes' own importer. Notes (after a single confirmation sheet on versions that ask — click Import) fills an Imported Notes folder (a fresh numbered one on older Notes; Notes 4.13 adds to an existing one, so the run looks for notes that were not there before), which the run polls until its note count stops growing. Each note is then matched back to its source by the Quip URL on its Source: provenance line (only that line counts, so a link to another exported document cannot mis-file a note) and moved into its mirrored folder under Quip. Notes it cannot match are left there and listed in the report, and the run exits with status 1 so they are not mistaken for a clean import.

A Markdown import has stalled when its folder gains no new note for 3 minutes. The run then stops waiting, files the notes that arrived, and recovers automatically: it quits and relaunches Notes, then re-imports the remaining documents through an archive (.quip2md/quip2md-fallback.enex). That needs one more Import confirmation on Notes versions that ask, and nested checklists in those notes arrive flat, as in any archive import.

The 3-minute cutoff applies only there, because the run then restarts Notes, which stops the importer. Every other import waits for the full 15-minute timeout: an archive import (the fallback archive included) never falls back, and with --no-fallback neither does a Markdown import. Any document still missing at the end is listed under failed, and the run exits with status 1.

This writer preserves:

  • clickable hyperlinks, including the link back to the original Quip document;
  • native checklists, with checked and unchecked state;
  • nested bullet lists, numbered lists, headings, code blocks, tables, images.

Its limitations: Notes' importer always creates checklist items at the top level, so nested checklists arrive flat (--indent-checklists restores their indentation by driving the Notes editor; it needs macOS Accessibility permission and is off by default), and it cannot update a note in place — see Re-run / update behavior. It also always imports into the default account, so --local is rejected with this writer.

applescript is the original writer, kept for environments that cannot use the importer. It cannot produce hyperlinks or checkboxes at all: Notes discards <a href> and every form of checkbox markup supplied through the scripting interface, so links become plain text and checklists become bullets containing literal [x] / [ ]. --indent-checklists is rejected with this writer: there are no checklists to indent.

What formatting survives

Verified against the real corpus by reading the imported notes back out of Notes and comparing them with what was sent:

Carried over How it lands in Notes
Bold, italic, strikethrough, inline code Real character formatting
Headings (#, ##, ###) Notes' Title / Heading / Subheading styles — stored as bold + a larger font rather than as <h2> tags
Tables A real Notes table
Nested bullet and numbered lists Real nested lists
Checklists, checked and unchecked Real tappable checkboxes
Hyperlinks, including the source link Real clickable links
Images Embedded attachments

On a 492-document account the renderer raised only 40 fidelity warnings, so the list below is everything that does not survive.

Fidelity caveats

With the markdown writer, Notes' Markdown importer:

  • Splits a list item that spans several lines into one item per line, so a multi-line checklist item arrives as several checkboxes. No text is lost.
  • Never embeds images and drops table cells after a URL. The run sends those documents through the archive instead, so they get the enex caveats below.

With the enex writer (and the archive part of a markdown run), Apple Notes still normalizes some things:

  • Nested checklists import flat unless --indent-checklists is used (the markdown writer keeps them nested).
  • Blockquotes keep their text but lose the quote styling.
  • Horizontal rules are dropped.
  • Links with schemes outside https, http, mailto and tel render as text.
  • A list that mixes checklist and plain items keeps the plain ones as bullets at their own depth.

Two things are worth knowing because they are Notes bugs rather than choices:

  • Angle brackets are escaped twice. Notes decodes an imported note's content and then re-parses the result as HTML, so a correctly escaped &lt;profile name&gt; becomes an element on the second pass and the text disappears. Writing &amp;lt; instead survives.
  • --indent-checklists changes a note's modification date, and that cannot be undone. Notes exposes modification date as read-only (AppleScript error -10006), and the only supported way to set it is at import time — which is necessarily before the indentation is applied. The markdown writer avoids the problem: its notes need no indentation pass. It is only needed for a document that has both nested checklists and an image or a table URL, which stays on the enex route.

export/ remains the full-fidelity Markdown backup by design — Notes is the working copy, export/ is the archive.

Time expectations

Measured on the same account (492 notes) with --writer enex:

  • Full import: 92.6 seconds, zero failures.
  • Immediate re-run (nothing changed): ~16 seconds, all 492 notes skipped-unchanged, zero duplicates.

Only one run at a time

Any run that changes Notes takes an exclusive lock on .quip2md/notes.lock for its duration, and a second one refuses to start rather than queue. Two concurrent runs would each read the state file, each conclude the same documents are missing, and each import them — duplicating the library, which is the most expensive mistake this tool can make. The lock is advisory and held by the process, so a crashed run leaves nothing stale behind. Dry runs and prune-notes plans read only and are never blocked.

Cleaning up after an import

import-notes never deletes anything. A re-imported document leaves its previous copy in Notes (recorded under superseded_note_ids), and every run leaves an empty landing folder (Imported Notes, Imported Notes N, or a quip2md-markdown-… folder inside one) behind. prune-notes is the one command that removes them, and it does nothing without --apply:

uv run quip2md prune-notes --superseded --empty-landing
Flag Effect
--superseded Delete the previous copy of every re-imported note, by the exact id recorded in notes_state.json, then clear those records. Never deletes an id that is still some document's current note.
--empty-landing Delete every top-level Imported Notes / Imported Notes N folder that holds no notes and no subfolders other than empty quip2md-markdown-… staging folders.
--folder NAME Delete a named top-level folder and everything in it. Repeatable. Refuses anything that is not a top-level folder of the account, and refuses Quip outright.
--apply Actually delete. Without it the plan is printed and nothing is touched.

A mistyped --source is an error, not a run over zero documents: reporting success having done nothing is the one outcome a migration must never fake.

Deleted notes and folders go to Notes' Recently Deleted, so this is recoverable for thirty days.

Order matters. Notes does not persist deleting a folder that still holds notes — it reports success and the folder is back moments later, which was observed on iCloud with a large folder while the empty ones stayed gone. Empty a folder first (--superseded), then delete it. prune-notes re-reads the account after deleting and reports any folder that came back rather than claiming a deletion that undid itself.

Troubleshooting

Symptom Meaning / fix
400/401 "invalid or expired" Your token has expired (observed live as HTTP 400). Mint a new one at https://quip.com/dev/token and update .env. Only applies to export — import-notes needs no token.
429 / 503 in verbose logs Normal rate-limit backoff during export — the client handles retries automatically. Just let it run.
Corrupted .quip2md/state.json export prints a clear manifest error and exits with status 2 rather than silently continuing. Delete .quip2md/state.json to start a fresh export (you'll lose incremental skip state, not any exported files).
Corrupted .quip2md/notes_state.json import-notes prints a clear state error and exits with status 2. Deleting the file lets the next run proceed, but since it wipes the id/hash mapping, that next run will recreate every note as a duplicate. If you actually want to start over, delete the Quip folder in Notes.app first, then delete .quip2md/notes_state.json and re-run.
--writer markdown needs Notes 4.13 This Notes cannot import Markdown. Use --writer enex, or omit --writer to get the right default.
import-notes on a non-macOS platform, or missing "On My Mac" account with --local Exits with status 2 and a clear message — this subcommand only works on macOS with Notes.app configured accordingly.

Exit codes

Code Meaning
0 Success, nothing failed.
1 One or more threads failed to export, or one or more notes failed to import or could not be matched back to a source (the markdown and enex writers leave those in their landing folder, whose name the report prints). See the printed report and .quip2md/last_run.json / .quip2md/last_notes_run.json.
2 A rejected flag combination (--local with --writer markdown or enex, --indent-checklists, --adopt-landing or --auto-confirm with --writer applescript, --writer markdown on Notes older than 4.13), or a configuration, manifest, or Notes-state error: missing QUIP_TOKEN (export), a corrupted state.json/notes_state.json, an API error during the initial folder walk, or, for import-notes, a non-macOS platform or a missing "On My Mac" account. A clear message is printed to stderr, no traceback.
130 Interrupted (Ctrl-C). The manifest/state file was already flushed; re-run the same command to resume.

About

Export Quip documents to Markdown (and optionally import them into Apple Notes)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages

Generated from jauderho/ghafiles