Skip to content

feat(cli): Add batch styling operations support #88

@arcaputo3

Description

@arcaputo3

Current State

The batch command currently only supports `put` and `putf` operations for values and formulas:

[
  {"op": "put", "ref": "A1", "value": "Hello"},
  {"op": "putf", "ref": "B1", "formula": "=A1"}
]

Proposal

Extend batch operations to support styling and other mutations:

[
  {"op": "put", "ref": "A1", "value": "Title"},
  {"op": "style", "ref": "A1:E1", "bold": true, "bg": "navy", "fg": "white"},
  {"op": "merge", "ref": "A1:E1"},
  {"op": "border", "ref": "A1:E10", "style": "thin"},
  {"op": "colwidth", "col": "A", "width": 15},
  {"op": "rowheight", "row": 1, "height": 20}
]

Benefits

  • Single-pass workbook creation with full formatting
  • Atomic operations (all succeed or none)
  • Reduced I/O (one read + one write)
  • Better for scripted/automated workflows
  • Enables complex template population

Proposed Operations

Operation Properties Description
put ref, value Set cell value (existing)
putf ref, formula Set formula (existing)
style ref, bold, italic, bg, fg, fontSize, fontName, align, valign, wrap, numFormat Apply cell style
merge ref Merge cell range
unmerge ref Unmerge cell range
border ref, style, color Apply borders
colwidth col, width Set column width
rowheight row, height Set row height
hide row OR col Hide row/column
comment ref, text, author Add cell comment

Implementation Notes

  1. Parse batch JSON into sealed trait of operations
  2. Execute operations sequentially on sheet
  3. Validate all operations before executing (fail-fast)
  4. Consider transaction-like semantics

Priority

Medium - significant usability improvement for automation.

Related

  • Similar to Excel's macro recording capability
  • Would enable "template" workflows

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions