Skip to content

Commit

Permalink
docs: excel expanded usage text with more examples
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
jqnatividad committed Nov 15, 2024
1 parent 28062f4 commit 35e803a
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/cmd/excel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ Export the last sheet (negative index)):
Export the second to last sheet:
qsv excel -s -2 input.xls
Export a table in an XLSX file:
Export a table named "Table1" in an XLSX file. Note that --sheet is not required
as the table definition includes the sheet.
qsv excel --table "Table1" input.xlsx
Export a range of cells in the first sheet:
qsv excel --range C3:T25 input.xlsx
Export a named range in the workbook:
Export a named range in the workbook. Note that --sheet is not required
as named ranges include the sheet.
qsv excel --range MyRange input.xlsx
Export a range of cells in the second sheet:
Expand All @@ -50,12 +52,20 @@ as it may contain special characters like ! and $:
qsv excel --range 'Sheet2!$C$3:$T$25' input.xlsx
Export metadata for all sheets in CSV format:
qsv excel --metadata csv input.xlsx
qsv excel --metadata c input.xlsx
# short CSV mode is much faster, but doesn't contain as much metadata
qsv excel --metadata short input.xlsx
qsv excel --metadata s input.xlsx
Export metadata for all sheets in JSON format:
qsv excel --metadata json input.xlsx
qsv excel --metadata j input.xlsx
# pretty-printed JSON
# pretty-printed JSON - first letter is capital J
qsv excel --metadata J input.xlsx
# short, minified JSON mode - first letter is capital S
qsv excel --metadata Short input.xlsx
qsv excel --metadata S input.xlsx
Prompt for spreadsheets to export and then prompt where to save the CSV:
qsv prompt -d ~/Documents -m 'Select a spreadsheet to export to CSV' -F xlsx,xls,ods | \
Expand Down Expand Up @@ -114,7 +124,10 @@ Excel options:
Only valid for XLSX files. The --sheet option is ignored as a table could
be in any sheet. Overrides --range option.
--range <range> An Excel format range - like RangeName, C:T, C3:T25 or 'Sheet1!C3:T25' to
extract to the CSV. If the range is not found, qsv will exit with an error.
extract to the CSV. If the specified range contains the required sheet,
the --sheet option is ignored.
If the range is not found, qsv will exit with an error.
--error-format <format> The format to use when formatting error cells.
There are 3 formats:
- "code": return the error code.
Expand Down Expand Up @@ -305,7 +318,7 @@ impl RequestedRange {
.map(|r| r - 1)
}

/// worksheet_size is from range.getsize, height,width. 1 indexed.
/// worksheet_size is from range.getsize, height,width. 1 indexed.
fn from_string(range: &str, worksheet_size: (usize, usize)) -> CliResult<RequestedRange> {
let Some((start, end)) = range.split_once(':') else {
return fail_clierror!("Unable to parse range string");
Expand Down

0 comments on commit 35e803a

Please sign in to comment.