Automating Google Sites: What Worked, What Failed, and What Cost a Rebuild
Description and use
Automating Google Sites publishing without an official API: the only reliable method is simulating keystrokes via a browser extension, handling non‑ASCII, list formatting, links, headings, and images.
Problem
Automating content publishing into Google Sites without an official API, ensuring persistence across reloads and handling editor quirks.
Outcome
The only reliable method was synthetic keystrokes via a browser automation extension, with careful handling of non‑ASCII, list formatting, links, headings, and image placement. This approach survived reloads and produced a stable Google Sites page.
Workflow
- 1. Verify editor uses internal document model by mutating DOM and reloading to confirm loss.
- 2. Test synthetic keystrokes via browser automation extension; ensure non‑ASCII characters are normalized to ASCII.
- 3. Avoid leading '- ' to prevent retroactive list formatting; if triggered, select all and toggle list button twice.
- 4. For hyperlinks, select anchor text, press cmd+k, click URL input, then click Apply via synthetic click events; avoid pressing Enter inside URL input.
- 5. Insert headings using cmd+alt+2 or cmd+alt+3 with ~3s pause between commands.
- 6. Upload images via file input; if crash occurs, handle manually or use separate layout block.
- 7. Duplicate root page to subpage to preserve title tag; set custom path in duplicate dialog.
- 8. After each change, reload to confirm autosave persisted.
- 9. Compile final page and publish.
Evidence
The only approach that updates the document model and survives a reload is sending synthetic keystrokes through a browser automation extension.
Typing, character by character, through the extension works, and persists.
- Record date: 2026-09-15T13:00:48.829Z