andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.77k stars 201 forks source link

Export all sheets, or particular sheet #859

Closed hseg closed 1 month ago

hseg commented 8 months ago

By remarks on #791, I must be doing something wrong, but: Both :e FORMAT [FILE] and echo 'export "FORMAT" "FILE"' | sc-im only export the first sheet in the file -- in plaintext formats, would expect to see all sheets, labelled and suitably concatenated. Unless this single-sheet-at-a-time is the intended behavior? In which case, I would expect there to be an option to export a specific sheet (to my understanding, :e's ability to export a selection is inaccessible in scripting, since there is no way to programmatically select a range). It would also help for this direction to be able to get the number of sheets in a file and to send multiple commands on stdin, but can find documentation for neither.

Version:

-DNCURSES
-DMAXROWS 65536
-DUNDO
-DXLSX
-DXLUA
-DDEFAULT_COPY_TO_CLIPBOARD_CMD="xclip -i -selection clipboard <"
-DDEFAULT_PASTE_FROM_CLIPBOARD_CMD="xclip -o -selection clipboard"
-DDEFAULT_OPEN_FILE_UNDER_CURSOR_CMD="scopen"
-DUSELOCALE
-DMOUSE
-DUSECOLORS
-D_XOPEN_SOURCE_EXTENDED
-D_GNU_SOURCE
-DSNAME="sc-im"
-DHELP_PATH="/usr/share/sc-im"
-DLIBDIR="/usr/share/doc/sc-im"
-DDFLT_PAGER="less"
-DDFLT_EDITOR="vim"
-DCONFIG_DIR=".config/sc-im"
-DCONFIG_FILE="scimrc"
-DHISTORY_DIR=".cache"
-DHISTORY_FILE="sc-iminfo"
-DINS_HISTORY_FILE="sc-iminfo"
-DHAVE_PTHREAD
-DAUTOBACKUP
andmarti1424 commented 7 months ago

Hello. Those commands should export the current sheet. Not the first one of the document. Regarding single-sheet-at-a-time export, I am afraid its the current behaviour. We might change it or add an option for exporting all sheets at once.

hseg commented 7 months ago

On Fri, Dec 29, 2023 at 03:56:44AM -0800, Andrés Gustavo Martinelli wrote:

Hello. Those command should export the current sheet. Not the first one on the document. Regarding single-sheet-at-a-time export, I am afraid its the current behaviour. We might change it or add an option for exporting all sheets at once.

OK, then in that case I'd appreciate guidance on how to script iterating through a file's sheets and exporting them one-by-one. I've since managed somehow to script multiple commands -- I don't know what went wrong with previous attempts, but have had success with (yes nextsheet | head -n"$i"; echo 'export "mkd" "sheet-$i.md") | sc-im ...