Crates.io | excel-cli |
lib.rs | excel-cli |
version | |
source | src |
created_at | 2025-04-24 09:56:09.192389+00 |
updated_at | 2025-05-07 15:03:10.989871+00 |
description | A lightweight terminal-based Excel viewer with Vim-like navigation for viewing, editing, and exporting Excel data to JSON format. |
homepage | |
repository | https://github.com/fuhan666/excel-cli |
max_upload_size | |
id | 1646965 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A lightweight terminal-based Excel viewer with Vim-like navigation for viewing, editing, and exporting Excel data to JSON format.
English | 中文
The package is published to crates.io and can be installed directly using:
cargo install excel-cli
Linux and macOS users may need to add execute permissions first
Requires Rust and Cargo. Install using the following commands:
# Clone the repository
git clone https://github.com/fuhan666/excel-cli.git
cd excel-cli
cargo build --release
# Install to system
cargo install --path .
cargo uninstall excel-cli
# Open an Excel file in interactive mode
excel-cli path/to/your/file.xlsx
# Export all sheets to JSON and output to stdout (for piping)
excel-cli path/to/your/file.xlsx --json-export
# Export with custom header direction and count
excel-cli path/to/your/file.xlsx -j -d v -r 2
# Pipe JSON output to another command
excel-cli path/to/your/file.xlsx -j > data.json # (example) Save JSON output to a file
--json-export
, -j
: Export all sheets to JSON and output to stdout (for piping)--direction
, -d
: Header direction in Excel: 'h' for horizontal (top rows), 'v' for vertical (left columns). Default: 'h'--header-count
, -r
: Number of header rows (for horizontal) or columns (for vertical) in Excel. Default: 1--lazy-loading
, -l
: Enable lazy loading for large Excel files (only loads data when needed)The application has a simple and intuitive interface:
h
, j
, k
, l
or arrow keys: Move between cells (1 cell)[
: Switch to previous sheet (stops at first sheet)]
: Switch to next sheet (stops at last sheet)0
: Jump to first column in current row^
: Jump to first non-empty column in current row$
: Jump to last column in current rowgg
: Jump to first row in current columnG
: Jump to last row in current columnCtrl+←
(or Command+←
on Mac): If current cell is empty, jump to the first non-empty cell to the left; if current cell is not empty, jump to the last non-empty cell to the leftCtrl+→
(or Command+→
on Mac): If current cell is empty, jump to the first non-empty cell to the right; if current cell is not empty, jump to the last non-empty cell to the rightCtrl+↑
(or Command+↑
on Mac): If current cell is empty, jump to the first non-empty cell above; if current cell is not empty, jump to the last non-empty cell aboveCtrl+↓
(or Command+↓
on Mac): If current cell is empty, jump to the first non-empty cell below; if current cell is not empty, jump to the last non-empty cell belowEnter
: Edit current celly
: Copy current cell contentd
: Cut current cell contentp
: Paste clipboard content to current cellu
: Undo the last operation (edit, row/column/sheet deletion)Ctrl+r
: Redo the last undone operation/
: Start forward search?
: Start backward searchn
: Jump to next search resultN
: Jump to previous search result:
: Enter command mode (for Vim-like commands)When editing cell content (press Enter
to enter edit mode):
Mode Switching:
Esc
: Exit Vim mode and save changesi
: Enter Insert modev
: Enter Visual modeNavigation (in Normal mode):
h
, j
, k
, l
: Move cursor left, down, up, rightw
: Move to next wordb
: Move to beginning of worde
: Move to end of word$
: Move to end of line^
: Move to first non-blank character of linegg
: Move to first lineG
: Move to last lineEditing Operations:
x
: Delete character under cursorD
: Delete to end of lineC
: Change to end of lineo
: Open new line below and enter Insert modeO
: Open new line above and enter Insert modeA
: Append at end of lineI
: Insert at beginning of lineVisual Mode Operations:
y
: Yank (copy) selected textd
: Delete selected textc
: Change selected text (delete and enter Insert mode)Operator Commands:
y{motion}
: Yank text specified by motiond{motion}
: Delete text specified by motionc{motion}
: Change text specified by motionClipboard Operations:
p
: Paste yanked or deleted textu
: Undo last changeCtrl+r
: Redo last undone changeEnter search mode by pressing /
(forward search) or ?
(backward search):
Enter
: Execute search and jump to the first matchEsc
: Cancel searchn
: Jump to next match (after search is executed)N
: Jump to previous match (after search is executed)Enter command mode by pressing :
. Available commands:
:cw fit
- Auto-adjust current column width to fit content:cw fit all
- Auto-adjust all column widths to fit content:cw min
- Minimize current column width (max 15 or content width):cw min all
- Minimize all column widths (max 15 or content width):cw [number]
- Set current column width to specified value:ej [h|v] [rows]
- Export current sheet data to JSON format
h|v
- Header direction: h
for horizontal (top rows), v
for vertical (left columns)rows
- Number of header rows (for horizontal) or columns (for vertical):eja [h|v] [rows]
- Export all sheets to a single JSON file
:ej
The output filename is automatically generated in one of these formats:
original_filename_sheet_SheetName_YYYYMMDD_HHMMSS.json
original_filename_all_sheets_YYYYMMDD_HHMMSS.json
The JSON files are saved in the same directory as the original Excel file.
:w
- Save file without exiting
:wq
or :x
- Save and exit
:q
- Quit (will warn if there are unsaved changes)
:q!
- Force quit without saving
See File Saving Logic for details on how files are saved.
:y
- Copy current cell content
:d
- Cut current cell content
:put
or :pu
- Paste clipboard content to current cell
:[cell]
- Jump to cell (e.g., :A1
, :B10
). Supports both uppercase and lowercase letters (:a1
works the same as :A1
)
:sheet [name/number]
- Switch to sheet by name or index (1-based):delsheet
- Delete the current sheet:dr
- Delete the current row:dr [row]
- Delete a specific row (e.g., :dr 5
deletes row 5):dr [start] [end]
- Delete a range of rows (e.g., :dr 5 10
deletes rows 5 through 10):dc
- Delete the current column:dc [col]
- Delete a specific column (e.g., :dc A
or :dc a
or :dc 1
all delete column A):dc [start] [end]
- Delete a range of columns (e.g., :dc A C
or :dc a c
deletes columns A through C):nohlsearch
or :noh
- Disable search highlighting:help
- Show available commandsExcel-CLI uses a non-destructive approach to file saving:
:w
, :wq
, or :x
), the application checks if any changes have been madeoriginal_filename_YYYYMMDD_HHMMSS.xlsx
MIT