Merges the plain text of many Google Docs into a single target Google Doc. Resumable, idempotent, timeout-safe.
flowchart LR
A["Source Folder\n(Google Drive)"] -->|recursive scan| B["Code.gs\n(Apps Script)"]
B -->|filter by year\nexclude folders\nsort newest→oldest| C[Candidate Docs]
C -->|export as\nplain text| B
B -->|chunked append| D["Target Doc\n(Google Docs)"]
B <-->|merged ID cache| E["ScriptProperties"]
D -->|"[MERGED_ID] markers\n(idempotency)"| B
- Go to script.new and create a new project.
- Replace
Code.gscontents with the script from this repo. - Enable Show "appsscript.json" manifest in Project Settings, then replace it with the one from this repo.
- Enable Drive API in the linked GCP project (Project Settings → GCP Project → APIs & Services → Enable).
- Set your IDs at the top of
Code.gs:
const FOLDER_ID = 'your-source-folder-id'; // Drive URL: /folders/<ID>
const TARGET_DOC_ID = 'your-target-doc-id'; // Doc URL: /document/d/<ID>/- Run
previewOrder()to verify the doc list looks right. - Run
mergeFast()to merge. Schedule it via Triggers for automatic recurring runs.