Hi.
I am using the example code to count rows and columns in a spreadsheet passed in as arguments via commandline.
The xlsxioread_sheet_open function does not seem to be honoring the flags.
Here is my code:
`#include
include
include
include
int main(int argc, char* argv[]) {
if (argc<2) {
printf("Usage: xl_row_col_count <Excel Filename>\n");
exit(1);
}
//open .xlsx file for reading
xlsxioreader xlsxioread;
const char* filename = argv[1];
if ((xlsxioread = xlsxioread_open(filename)) == NULL) {
fprintf(stderr, "Error opening .xlsx file\n");
return 1;
}
//read values from first sheet
int row_count = 0;
int col_count = 0;
char* value;
xlsxioreadersheet sheet;
const char* sheetname = NULL;
printf("Contents of first sheet:\n");
if ((sheet = xlsxioread_sheet_open(xlsxioread, sheetname, XLSXIOREAD_SKIP_EXTRA_CELLS | XLSXIOREAD_SKIP_EMPTY_ROWS)) != NULL) {
//read all rows
while (xlsxioread_sheet_next_row(sheet)) {
row_count++;
//read all columns
while ((value = xlsxioread_sheet_next_cell(sheet)) != NULL) {
//printf("%s\t", value);
xlsxioread_free(value);
if (value != NULL) {
if (strcmp(value, "") != 0) {
col_count++;
}
}
}
}
xlsxioread_sheet_close(sheet);
printf("%d Rows, %d Columns.\n",row_count, col_count);
}
//clean up
xlsxioread_close(xlsxioread);
Hi. I am using the example code to count rows and columns in a spreadsheet passed in as arguments via commandline. The xlsxioread_sheet_open function does not seem to be honoring the flags. Here is my code:
`#include
include
include
include
int main(int argc, char* argv[]) {
}`