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.
Bug:
importcommand reports success but writes no data to Excel fileDescribe the bug
The
officecli importcommand 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)Step 2: Create a blank Excel file and import the CSV
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
Step 6: Verify via raw XML — sheetData is empty
officecli raw test.xlsx /xl/worksheets/sheet1.xml # Result: <sheetData/> contains no imported rows/cellsExpected behavior
Imported CSV data should appear in the target sheet cells. File size should increase.
officecli view test.xlsx outlineshould 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
irm https://d.officecli.ai/install.ps1 | iexAdditional context
officecli setworks fine (control test passed)OFFICECLI_NO_AUTO_RESIDENT=1— same result--fileoption and positional argument)--stdin)--headerflag on and off--start-cellwith different positionsThe issue appears to be in the
importcommand'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.