summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordave <ydrah32@gmail.com>2019-01-14 16:05:54 +0000
committerdave <ydrah32@gmail.com>2019-01-14 16:05:54 +0000
commit43d5fc7145244a306215c7b227fa715ff59cad2a (patch)
treeae15a4eec1b4a26b55b4218885b18ecd56b669bb
parent820079e4977f02dfd20cb25f38e412da2ff874bb (diff)
added --sheet to doc, fixed minor bug
-rwxr-xr-xsrc/doc10
-rw-r--r--src/sc-im.12
-rw-r--r--src/xlsx.c2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/doc b/src/doc
index b70f487..bd625d6 100755
--- a/src/doc
+++ b/src/doc
@@ -1388,6 +1388,16 @@ Commands for handling cell content:
--txtdelim=","
--txtdelim=";"
+ If you pass a .xlsx file to SC-IM, you can specify which sheet to load
+ with the --sheet parameter, which can be the name or number of a sheet.
+ Default value is 1.
+
+ Example: ./sc-im --sheet=dogs file.xlsx
+
+ Some possible values are:
+ --sheet=3
+ --sheet=dogs
+
==============================================================================
&External scripts&
diff --git a/src/sc-im.1 b/src/sc-im.1
index 469b74c..5c26606 100644
--- a/src/sc-im.1
+++ b/src/sc-im.1
@@ -42,7 +42,7 @@ functional similarities with vim text editor.
The input file from where to read the spreadsheet.
.TP
.BR \-\^\-sheet=SHEET
-Open SHEET, which can be sheet name or number. Default is 'sheet1'.
+Open SHEET when loading xlsx file. Can be sheet name or number. Default is '1'.
.SS "Version"
.TP
.BR \-\^\-version
diff --git a/src/xlsx.c b/src/xlsx.c
index 26d53e6..a8d7d18 100644
--- a/src/xlsx.c
+++ b/src/xlsx.c
@@ -453,7 +453,7 @@ int open_xlsx(char * fname, char * encoding) {
if ( ! found ){
// use sheet number if sheet name does not match
name = get_conf_value("sheet");
- int i = strlen(name)-1;
+ int i = strlen(name);
while( --i >= 0 && isdigit(name[i]) > 0 );
name = i < 0 ? "sheet":"";
snprintf(namebuf,30,"xl/worksheets/%s%s.xml",name,get_conf_value("sheet"));