gsheet-append-dedup
Safely write structured surgery rows (TSV / row arrays) into Google Sheet with dedup by primary key, date-correct insertion when filling earlier dates…
Skill by gricn
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/gricn-gsheet-append-dedup
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: spreadsheets, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/gsheet-append-dedup
What's inside
- Skill name
gsheet-append-dedup- Description
- Safely write structured surgery rows (TSV / row arrays) into Google Sheet with dedup by primary key, date-correct insertion when filling earlier dates, blank-only patch semantics on existing rows, and full black borders on freshly written rows. Used for "schedule OCR result writeback" and "patch missing fields" scenarios.
- License
- MIT
- Instructions
- 134 lines in SKILL.md · view on GitHub
Files (3)
- SKILL.md
- .gitkeep · scripts/
- README.md · scripts/
SKILL.md (first lines)
# GSheet Append Dedup
## Overview
Default writeback semantics:
- **Primary key not found**: write into the date-correct position. If the date is older than the current tail, insert before the first later-date row — do not just append to the bottom.
- **Primary key found**: do not create a duplicate row; patch only the blank cells in the existing row.
- **Newly appended rows**: apply uniform black full borders (including innerHorizontal / innerVertical).
- **With explicit user authorization**: a specified column may overwrite existing non-blank values (used for post-op result patches). `remarks` is the exception — even with override authorization, new remarks are appended after the old, not overwritten.
Default target sheet:
- Spreadsheet ID: `<cathlab-summary-sheet-id>`
- Tab: `<cathlab-summary-sheet-name>`
- Explicit user-provided sheet / tab overrides defaults.
## Trigger Conditions
- "Append to the bottom of Google Sheet / table".
- "Skip if duplicate" or "patch only missing fields".
- "Add black border to new rows".
- User supplies TSV and asks for auto Google Sheet writeback.
## Assumption
The target is **Google Sheets**, not Google Docs. If the user says "Google Docs" but the request is row / column / border / append-to-bottom shaped, treat as Sheets.
## Workflow
1. Read the target header and build a column-name map.
2. Read existing data rows and build a primary-key index.
3. For each input row:
- Key not found: queue into `to_append`.
- Key found: write non-blank new values only into existing blank cells (`to_patch`).
- With explicit column override authorization: only those columns may overwrite existing non-blank values; other columns still blank-fill only.
4. Run patches first, then appends. If a new date is earlier than the current tail, insert before the first later-date row.
5. Apply uniform black full borders to the just-written set.
6. Emit a summary.
## Default rules
- Default primary key: `surgery_date + patient_id`.
- Primary-key match ignores trailing `?` on `patient_id` (avoids re-appending tagged uncertainty markers).
- Blank-only by default.
- Override existing non-blank only when explicitly authorized per column.
- `remarks` is append-only, even with override authorization.
- `surgery_type` is a controlled English-code field: only `AF / SVT / WPW / AT / AFL / PAC / PVC / EPS / LAAC / VT` (or `+` combinations). Reject Chinese or free-form text before write.
- Multiple existing rows on the same key → skip the row and flag `needs human review`.
- Duplicates do not raise — they are routed to patch / skip.
## Border rule
For **all written rows** in this round (append + patch):
- Range: column 1 to the last output column.
- Style: black, solid, full borders (including innerHorizontal / innerVertical).
- Patch rows also get re-applied borders — historical stub rows (see below), once filled, must not look unformatted.
- Already-complete rows are not actively re-bordered (skipped rows are untouched).
## Output summary
- `append_count`
- `patch_count`
- `skip_count`
- `conflict_count` (multiple rows for one key)
## Known edge cases
### Stub rows
The sheet may carry stub rows with only `date + patient_id` (rest blank) — typically pre-filled from schedule planning.
**Past bug**: Google Sheets stores dates as integer serials (e.g. `46097` = 2026-03-16). `FORMATTED_VALUE` reads can return the integer string, breaking primary-key matching → stub row is ignored → data is appended as new → duplicate row.
**Fix**: `parse_date_to_iso` now recognizes:
- ISO text formats: `2026-03-16`, `2026/03/16`
- Google Sheets serial (int / float / numeric string in range 1–99999) → converts to ISO.
### Duplicate-row cleanup
If after a run there are multiple rows for the same key (stub + full), the script does NOT auto-delete — requires explicit human or scripted deletion via `batchUpdate -> deleteDimension`.
## Safety
- No write access → return preview stats only, no writes.
- No auto row deletion.
- No history reordering. No overrides on human-filled non-blank content (unless explicitly authorized).
## Format consistency check (mandatory before write)
### Past pitfall
Writing formulas directly produced inconsistency with history:
- weekday column: history was plain text `周一` ("Monday"); new write rendered the formula as `一` ("one")
- month column: history was plain text `2026年03月` ("March 2026"); new write rendered as serial `46082`
### Fixed-fix
Pre-write history check, using both renderings:
```python
resp_raw = svc.spreadsheets().values().get(
spreadsheetId=SPREADSHEET_ID,
range=f'{TAB}!A253:J256',
valueRenderOption='UNFORMATTED_VALUE',
).execute()
resp_fmt = svc.spreadsheets().values().get(
spreadsheetId=SPREADSHEET_ID,
range=f'{TAB}!A253:J256',
valueRenderOption='FORMATTED_VALUE',
).execute()
# UNFORMATTED `周一` → plain text → new row must be plain text too
# UNFORMATTED `=TEXT(...)` → formula → new row may use formula
```
Live audit discipline added:From gricn/clinical-ops-skill-kit, MIT.
More from gricn/clinical-ops-skill-kit
- 0.479score
vendor-invoice-records
gricn
On an Android device with the vendor B2B app, iterate orders, enter detail, click "申请开票" to open the invoice WebView, capture the commodity-fee and…
SkillCFreshness: CClaude Code +9 - 0.479score
warehouse-shipment-planning
gricn
After each surgery day, compute a shipment / replenishment plan for the upstream warehouse, based on the "patient_id = blank" remainder rows in the formal…
SkillCFreshness: CClaude Code +9 - 0.479score
surgery-volume-summary
gricn
Strictly summarize user-supplied weekly / monthly / yearly surgery statistics into a single closed-form line.
SkillCFreshness: CClaude Code +9 - 0.479score
cathlab-schedule-ocr
gricn
Handle cathlab surgery schedule input (images, Word docs, or mixed multi-file).
SkillCFreshness: CClaude Code +9 - 0.476score
tencent-docs-api-v3
gricn
Tencent Docs API V3 client wrapper.
SkillCFreshness: CClaude Code +9 - 0.475score
spd-confirm-supply
gricn
On the `<hospital>` SPD / sp.<vendor-portal>.com homepage right-side to-do, handle "you have N pending-confirm orders": enter the pending-confirm order…
SkillCFreshness: CClaude Code +9 - 0.475score
vendor-sales-inventory-sync
gricn
When the user says "materials have arrived", "today's materials are in the cath lab", or similar, auto-trigger this skill.
SkillCFreshness: CClaude Code +9 - 0.475score
material-complaint-update
gricn
Update existing rows in the formal Tencent Docs inventory sheet for live material-complaint cases based on package-label photos and same-day case context.
SkillCFreshness: CClaude Code +9 - 0.475score
order-shipment
gricn
Full pipeline for `<hospital>` SPD / sp.<vendor-portal>.com shipment orders: login, scan pending shipments, lock this round's scope (this batch from Excel /…
SkillCFreshness: CClaude Code +9 - 0.475score
spd-confirm-delivery
gricn
Fast path: in the `<hospital>` SPD / sp.<vendor-portal>.com visible page, complete the current pending slip's `发货 → 确认` chain and verify success.
SkillCFreshness: CClaude Code +9 - 0.474score
task-closeout-standards
gricn
When the user asks to summarize pitfalls, codify lessons, tighten closeout standards, or judge whether a task is truly closed, trigger this thin entry.
SkillCFreshness: CClaude Code +9 - 0.473score
surgery-summary
gricn
Summarize daily surgery records from markdown files under `surgery_records/YYYY/MM/`.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- May 26, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/gricn/clinical-ops-skill-kit
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from gricn
- 0.479score
vendor-invoice-records
gricn
On an Android device with the vendor B2B app, iterate orders, enter detail, click "申请开票" to open the invoice WebView, capture the commodity-fee and…
SkillCFreshness: CClaude Code +9 - 0.479score
warehouse-shipment-planning
gricn
After each surgery day, compute a shipment / replenishment plan for the upstream warehouse, based on the "patient_id = blank" remainder rows in the formal…
SkillCFreshness: CClaude Code +9 - 0.479score
cathlab-schedule-ocr
gricn
Handle cathlab surgery schedule input (images, Word docs, or mixed multi-file).
SkillCFreshness: CClaude Code +9 - 0.479score
surgery-volume-summary
gricn
Strictly summarize user-supplied weekly / monthly / yearly surgery statistics into a single closed-form line.
SkillCFreshness: CClaude Code +9 - 0.476score
tencent-docs-api-v3
gricn
Tencent Docs API V3 client wrapper.
SkillCFreshness: CClaude Code +9 - 0.475score
order-shipment
gricn
Full pipeline for `<hospital>` SPD / sp.<vendor-portal>.com shipment orders: login, scan pending shipments, lock this round's scope (this batch from Excel /…
SkillCFreshness: CClaude Code +9
Cite this page
gsheet-append-dedup skill. Agent Mart. https://agentmart.dev/skills/gricn-gsheet-append-dedup (last updated 2026-10-24)