summaryrefslogtreecommitdiffstats
path: root/src/xlsx.c
diff options
context:
space:
mode:
authordave <ydrah32@gmail.com>2019-01-10 00:43:08 -0600
committerdave <ydrah32@gmail.com>2019-01-10 00:43:08 -0600
commitf8b77259c014fc01bf3d2414322edc592505f3a9 (patch)
treeb173a21f0815c14d751e40f1994f6c6dc5061ae5 /src/xlsx.c
parentf0e9c30d8078d83221c51d86d350d541217a3d44 (diff)
sheet can be specified with name or number
Diffstat (limited to 'src/xlsx.c')
-rw-r--r--src/xlsx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/xlsx.c b/src/xlsx.c
index ca90201..b88f67c 100644
--- a/src/xlsx.c
+++ b/src/xlsx.c
@@ -412,10 +412,14 @@ int open_xlsx(char * fname, char * encoding) {
}
zip_fclose(zf);
- // open specified sheet
+ // open specified sheet. Add "sheet" to name if given just a number.
if (get_conf_value("sheet") != NULL){
char namebuf[256];
- snprintf(namebuf,256,"xl/worksheets/%s.xml",get_conf_value("sheet"));
+ name = get_conf_value("sheet");
+ int i = strlen(name)-1;
+ while( --i >= 0 && isdigit(name[i]) > 0 );
+ name = i < 0 ? "sheet":"";
+ snprintf(namebuf,256,"xl/worksheets/%s%s.xml",name,get_conf_value("sheet"));
name = namebuf;
} else {
// open sheet1 if none specified