Skip to content

Commit

Permalink
added xlsx2csv to first convert xlsx to csv and then display the csv …
Browse files Browse the repository at this point in the history
…content
  • Loading branch information
wofr06 committed Jan 4, 2025
1 parent 5d287f1 commit 2ecab17
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
****************************************************************************
# ChangeLog for lesspipe.sh #
****************************************************************************
- added xlsx2csv to first convert xlsx to csv and then display the csv content
- added optional minimal version check for external commands
Version 2.17 Dec 22 2024
- evaluation of current locale changed (compatible with old bash versions)
- correct typo in xlsx files handling
Expand Down Expand Up @@ -102,7 +104,7 @@ Version 2.00-beta Dec 22 2021
- added better bsdtar handling from the contributed bsdtar patch (Jim Pryor)
- added -layout option to pdftotext (Sergio Callegari)
- changed code for extraction of less calling parameters
- dont engage lesspipe in pipes (LESSPIPE=|-...), if called from man and perldoc
- don't engage lesspipe in pipes (LESSPIPE=|-...), if called from man and perldoc
- iconv handles most conversions from non foreign encodings
- tarcolor enhanced and renamed to archive_color, archive listings colorizations
Version 2.00-alpha Dec 8 2021
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Several Linux distributions do now set **LESSOPEN** by default and if the conten
- ods requires `xlscat` or `libreoffice`
- MS Word (docx) requires `pandoc` or `docx2txt` or `libreoffice`
- Powerpoint (pptx) requires `pptx2md` or `libreoffice`
- Excel (xlsx) requires `in2csv` or `xlscat` or `excel2csv` or `libreoffice`
- Excel (xlsx) requires `xlsx2csv` (>= 0.8.3) or `in2csv` or `xlscat` or `excel2csv` or `libreoffice`
- csv requires `csvtable` or `csvlook` or `column` or `pandoc`
- rtf requires `unrtf` or `libreoffice`
- epub requires `pandoc`
Expand Down Expand Up @@ -455,6 +455,7 @@ STDOUT and the commands executed to STDERR.
- unrtf https://www.gnu.org/software/unrtf/ (2018)
- wvText https://github.com/AbiWord/wv/ (2014)
- xlscat https://metacpan.org/pod/Spreadsheet::Read (2024)
- xlsx2csv (>=0.8.3) https://github.com/dilshod/xlsx2csv (2024)
- sxw2txt https://vinc17.net/software/sxw2txt (2010)
- dtc https://git.kernel.org/cgit/utils/dtc/dtc.git (2024)
- xmq https://github.com/libxmq/xmq/releases/latest (2024)
Expand Down
3 changes: 3 additions & 0 deletions lesspipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ lesspipe_version=2.17
# Author: Wolfgang Friebel (wp.friebel AT gmail.com)

has_cmd () {
[[ -n "$2" && "$2" > $($1 --version 2>/dev/null) ]] && return 1
command -v "$1" > /dev/null
}

Expand Down Expand Up @@ -297,7 +298,9 @@ get_unpack_cmd () {
has_cmd zstd && cmd=(zstd -cdqM1073741824 "$2") ;;
lz4)
has_cmd lz4 && cmd=(lz4 -cdq "$2") ;;
# xls(x) output looks better if transformed to csv and then displayed
xlsx)
{ has_cmd xlsx2csv 0.8.3 && cmd=(xlsx2csv "$2"); } ||
{ has_cmd in2csv && cmd=(in2csv -f xlsx "$2"); } ||
{ has_cmd excel2csv && cmd=(istemp excel2csv "$2"); } ;;
ms-excel)
Expand Down

0 comments on commit 2ecab17

Please sign in to comment.