Skip to content

Unable to obtain all sheets in xlsx #143

@Huu-Yuu

Description

@Huu-Yuu

Hello, the following is my Demo code. There are actually 18 sheets in the xlsx file I input, but it can only traverse 3. Then I modified the names of 18 sheets. After re running, I can traverse 6. However, I can't traverse all the sheets anyway. Do you have any other parameters to configure?
(I deleted the unimportant code)

std::mapstd::string,SheetData read_excel_file(const std::string& file_path) {

xlsxioreader xlsxioread;
if (!(xlsxioread = xlsxioread_open(file_path.c_str()))) {
    throw std::runtime_error("open err xslx: " + file_path);
}
xlsxioreadersheetlist sheetlist;
if ((sheetlist = xlsxioread_sheetlist_open(xlsxioread)) == nullptr){
    throw std::runtime_error("open err sheet: " + file_path);
}
char* value;
const char* sheetname;
while ((sheetname = xlsxioread_sheetlist_next(sheetlist)) != nullptr) {
    std::cout << " sheet name --- " << sheetname << std::endl;
    xlsxioreadersheet sheet = xlsxioread_sheet_open(xlsxioread, sheetname, XLSXIOREAD_SKIP_EMPTY_ROWS);

    while (xlsxioread_sheet_next_row(sheet)) {

        while ((value = xlsxioread_sheet_next_cell(sheet)) != nullptr) {

            xlsxioread_free(value);
        }
    xlsxioread_sheet_close(sheet);
}
xlsxioread_sheetlist_close(sheetlist);
xlsxioread_close(xlsxioread);
return xxxxxx;

}

The following is the result of my copy run. The input is the same xlsx file. The sheet is named differently, and the number of traversals is also different(Each of my sheets has 2005 rows, and there are 18 sheets in total)

sheet name --- sheet1
sheet name --- sheet2
sheet name --- sheet3

==============================================================

sheet name --- 0-255
sheet name --- 255-510
sheet name --- 510-765
sheet name --- 765-1020
sheet name --- 1020-1275
sheet name --- 1275-1530

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions