使用 gog docs create --file 将 Markdown 文件转换为格式整洁的 Google Docs,支持原生表格、标题、粗体、列表和可点击链接。
Create professionally formatted Google Docs from markdown using gog docs create --file. The key insight: markdown tables and formatting render properly as native Google Docs elements when passed through the --file flag.
Always use gog docs create with --file to import markdown. Never use gog docs write or gog docs insert for full documents — those don't parse markdown tables.
bash
gog docs create "Doc Title" --file source.md --parent "FOLDER_ID" --pageless --force --no-input
Flags:
--file — Import markdown file (required for proper table rendering)--parent — Google Drive folder ID--pageless — Use pageless layout (recommended for reports/audits)--force — Skip confirmationsMarkdownGoogle Docs Element# Heading 1HEADING_1## Heading 2HEADING_2### Heading 3HEADING_3**bold text**Bold text*italic text*Italic text- item or * itemBullet list1. itemNumbered list| col1 | col2 |Native TABLE element[link text](url)Clickable hyperlink---Horizontal rule> blockquoteIndented text
Markdown pipe tables render as native Google Docs tables — this is the main value of this skill. Tables are the element most likely to break when creating docs any other way.
Correct format:
markdown
| # | Document | Link |
|---|----------|------|
| 01 | Technical SEO Audit | [Open doc](https://docs.google.com/document/d/DOC_ID/edit) |
| 02 | On-Page SEO Audit | [Open doc](https://docs.google.com/document/d/DOC_ID/edit) |
What NOT to do:
\t between columns)gog docs write with raw text (doesn't parse markdown)markdown
# Project Name — Deliverables Master Index
*Last updated: DATE*
---
## 📋 Section Name
### Subsection
| # | Document | Link |
|---|----------|------|
| 01 | Document Name | [Open doc](https://docs.google.com/document/d/DOC_ID/edit) |
| 02 | Document Name | [Open doc](https://docs.google.com/document/d/DOC_ID/edit) |
---
## 🎨 Another Section
### Subsection
| # | Document | Link |
|---|----------|------|
| 01 | Document Name | [Open doc](https://docs.google.com/document/d/DOC_ID/edit) |
---
## 📂 Folder Structure
- **Root:** Folder Name
- **Subfolder**
- Document 1
- Document 2
markdown
# Report Title: Descriptive Subtitle
**URL:** /page-slug/
**Target Keywords:** keyword1, keyword2, keyword3
**Meta Title:** SEO Title (60 chars)
**Meta Description:** Meta description (155 chars)
---
## Section Heading
Body paragraph with **bold key terms** and normal text.
### Subsection
| Metric | 2024 | 2023 | Change |
|--------|------|------|--------|
| Value 1 | 232 | 274 | -15% |
**Key takeaway:** Summary sentence after the table.
### Another Subsection
- **Bold label** — Description text
- **Bold label** — Description text
cat > /tmp/doc_name.md << 'EOF'gog docs create "Title" --file /tmp/doc_name.md --parent FOLDER_ID --pageless --force --no-inputgog docs structure DOC_ID --no-input | grep -i tablegog docs cat DOC_ID --no-input | head -20After creating, verify:
gog docs structure shows TABLE elements (not just NORMAL_TEXT with pipe characters)[table 6x3])[Open doc](url) renders as hyperlinksTo replace a badly formatted doc:
--file flaggog drive rename NEW_ID "Original Name" --force --no-inputgog drive delete OLD_ID --force --no-inputgog drive move NEW_ID --parent FOLDER_ID --force --no-inputProblemCauseFixTables show as pipe-separated textUsed gog docs write instead of --fileRecreate with gog docs create --fileLinks not clickableUsed plain URLs, not markdown link syntaxUse [text](url) formatNo headingsUsed underline-style headingsUse # prefix headingsMissing boldUsed HTML <b> tagsUse **text** markdownRate limit (429)Too many API calls in short timeAdd sleep 3 between operations
Google Docs API has per-minute write quotas. When creating multiple docs:
sleep 3 between create operationssleep 5 between eachTo build a link index:
gog drive ls --parent FOLDER_ID --json --no-inputpython3 -c "import json,sys; data=json.load(sys.stdin); [print(f'{f[\"name\"]} | {f[\"id\"]}') for f in data.get('files',[])]"https://docs.google.com/document/d/DOC_ID/edit