Skip to content

Incorrect reading of data with empty cells when used with pyexcel. #8

@qria

Description

@qria

Summary

Reading an xlsx file with empty cell results in a misaligned reading.

Expected Behaviour

Input

image

Expected

> pyexcel.get_sheet(file_name="messy2.xlsx")

Sheet1:
+-----+-----+-----+
| a   | b   | c   |
+-----+-----+-----+
| 1.0 | 2.0 |     |
+-----+-----+-----+
|     | 2.0 | 3.0 |
+-----+-----+-----+
| 4.0 | 5.0 |     |
+-----+-----+-----+

Actual Result

> pyexcel.get_sheet(file_name="messy2.xlsx")

Sheet1:
+-----+-----+---+
| a   | b   | c |
+-----+-----+---+
| 1.0 | 2.0 |   |
+-----+-----+---+
| 2.0 | 3.0 |   |
+-----+-----+---+
| 4.0 | 5.0 |   |
+-----+-----+---+

Skimming the code it looks like pyexcel-xlsxr incorrectly assumes that data is already aligned.

FYI <sheetData/> part of the sheet xml looks like follows:

<row r="1">
    <c r="A1" s="1" t="s"><v>0</v></c>
    <c r="B1" s="1" t="s"><v>1</v></c>
    <c r="C1" s="1" t="s"><v>2</v></c>
</row>
<row r="2">
    <c r="A2" s="1"><v>1.0</v></c>
    <c r="B2" s="1"><v>2.0</v></c>
</row>
<row r="3">
    <c r="B3" s="1"><v>2.0</v></c>
    <c r="C3" s="2"><v>3.0</v></c>
</row>
<row r="4">
    <c r="A4" s="1"><v>4.0</v></c>
    <c r="B4" s="1"><v>5.0</v></c>
</row>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions