Skip to content

Direct writes to cells yield weird results #140

Closed
@Sweepi

Description

@Sweepi

Hi,

sorry if I am missing sth. obvious, but accessing cells via rowID and columnID does not work as intended for me, the writes affects all-1 rows of a column.
Reproducer:

TestSheet0 = pyexcel.Sheet()
TestSheet0[6, 6] = "6x6" # For some reason, the first cell written to defines the dimension of the 2d array
for row in range(0,3):
  for col in range (0,3):
    TestSheet0[row, col] = "{}x{}".format(row, col)
print("")
print("Final TestSheet0: ")
print(TestSheet0.content)
print("")
print("")

TestSheet1 = pyexcel.Sheet()
TestSheet1[4, 4] = "4x4" # For some reason, the first cell written to defines the dimension of the 2d array
for row in range(0,2):
  for col in range (0,2):
    print(TestSheet1.content)
    print("Writing {}x{}".format(row, col))  
    TestSheet1[row, col] = "{}x{}".format(row, col)
print("")
print("Final TestSheet1: ")
print(TestSheet1.content)
print("")
print("")

Output:

Final TestSheet0:
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
| 2x0 | 2x1 | 2x2 |   |   |   |     |
+-----+-----+-----+---+---+---+-----+
|     |     |     |   |   |   | 6x6 |
+-----+-----+-----+---+---+---+-----+


+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   |     |
+---+---+---+---+-----+
|   |   |   |   | 4x4 |
+---+---+---+---+-----+
Writing 0x0
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
| 0x0 |   |   |   |     |
+-----+---+---+---+-----+
|     |   |   |   | 4x4 |
+-----+---+---+---+-----+
Writing 0x1
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 0x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
|     |     |   |   | 4x4 |
+-----+-----+---+---+-----+
Writing 1x0
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 0x1 |   |   |     |
+-----+-----+---+---+-----+
|     |     |   |   | 4x4 |
+-----+-----+---+---+-----+
Writing 1x1

Final TestSheet1:
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
| 1x0 | 1x1 |   |   |     |
+-----+-----+---+---+-----+
|     |     |   |   | 4x4 |
+-----+-----+---+---+-----+

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions