Skip to content

CLI: Auto-split comma-separated values in put command #186

@arcaputo3

Description

@arcaputo3

Summary

When using put with a range and comma-separated values, the CLI currently treats the entire string as a single text value:

xl -f file.xlsx -s Sheet1 -o out.xlsx put A1:A5 1,2,3,4,5
# Current: All 5 cells get text "1,2,3,4,5"
# Expected: A1=1, A2=2, A3=3, A4=4, A5=5

Proposed Behavior

When the number of comma-separated values matches the number of cells in the range, distribute values across cells with smart type detection.

Considerations

  1. Ambiguity: What if someone wants literal text "1,2,3,4,5"?

    • Option A: Add --no-split flag to preserve literal behavior
    • Option B: Only split when count matches exactly, otherwise treat as text
    • Option C: Require quotes for literal text: put A1 '"1,2,3,4,5"'
  2. Smart detection: Apply same auto-detection as batch JSON (numbers, dates, currency, percent)

  3. Edge cases:

    • Quoted values with commas: "Hello, World",Foo,Bar
    • Trailing/leading whitespace handling
    • Empty values: 1,,3 (should become 1, empty, 3?)

Workaround

Use batch JSON syntax which already supports this:

echo '[{"op":"put","ref":"A1","value":1},{"op":"put","ref":"A2","value":2}]' | xl -f file.xlsx -s Sheet1 -o out.xlsx batch -

Priority

Low - ergonomics improvement, not a blocker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions