Skip to content

Bug: import command reports success but writes no data to Excel file #316

Description

@Andury

Bug: import command reports success but writes no data to Excel file

Describe the bug

The officecli import command reports successful import (e.g. "Imported 4 rows x 4 cols"), but no data is actually written to the Excel file. The file size remains unchanged, and reading back cells shows them as empty.

This affects all import variants: CSV, TSV, file input, stdin input, with or without --header.

To Reproduce

Step 1: Create a CSV file (data.csv)

Name,Age,City,Salary
Alice,28,Beijing,15000
Bob,35,Shanghai,25000
Charlie,22,Guangzhou,8000

Step 2: Create a blank Excel file and import the CSV

officecli create test.xlsx
officecli import test.xlsx /Sheet1 data.csv --header --json

Step 3: Import command returns success

{
  "success": true,
  "data": "Imported 4 rows x 4 cols into /Sheet1 starting at A1",
  "message": "Imported 4 rows x 4 cols into /Sheet1 starting at A1"
}

Step 4: Check the actual data — sheet is empty

officecli view test.xlsx outline
# Output: "Sheet1" (0 rows × 0 cols)
officecli get test.xlsx /Sheet1/A1 --json
# Result: text: "(empty)"

Step 5: Verify file size is unchanged

Before import: 3860 bytes
After import:  3860 bytes  (0 bytes difference)

Step 6: Verify via raw XML — sheetData is empty

officecli raw test.xlsx /xl/worksheets/sheet1.xml
# Result: <sheetData/> contains no imported rows/cells

Expected behavior

Imported CSV data should appear in the target sheet cells. File size should increase. officecli view test.xlsx outline should show the correct row/column count.

Actual behavior

Command reports success but no data is written. File size stays the same. Sheet remains empty.

Environment

  • OS: Windows (PowerShell 5)
  • OfficeCLI version: v1.0.144
  • Installation method: irm https://d.officecli.ai/install.ps1 | iex

Additional context

  • Basic cell writing with officecli set works fine (control test passed)
  • Tested with both resident mode (default) and OFFICECLI_NO_AUTO_RESIDENT=1 — same result
  • Tested variants (all fail silently):
    • CSV and TSV formats
    • File input (--file option and positional argument)
    • stdin input (--stdin)
    • --header flag on and off
    • --start-cell with different positions
    • ASCII and UTF-8 (Chinese) content

The issue appears to be in the import command's write path — it parses the data correctly (accurate row/col counts in the success message) but never flushes the imported cells to the worksheet.

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