diff --git a/src/cmd/excel.rs b/src/cmd/excel.rs index 65d5be351..a797be42b 100644 --- a/src/cmd/excel.rs +++ b/src/cmd/excel.rs @@ -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: @@ -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 | \ @@ -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 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 The format to use when formatting error cells. There are 3 formats: - "code": return the error code. @@ -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 { let Some((start, end)) = range.split_once(':') else { return fail_clierror!("Unable to parse range string");