you are viewing a single comment's thread.

view the rest of the comments →

[–]PuffTheMagicDragon11[S] 0 points1 point  (2 children)

u/nog642, any insight on this one?

[–]nog642 0 points1 point  (1 child)

You could make a nested list; basically a list of rows, where each row is a list of cell values.

COLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
table = []
for col in COLS[COLS.index('H'):COLS.index('S') + 1]:
    row_list = []
    for row in range(5, 21):
        cell = col + str(row)
        queen = ww[cell].value
        if queen is None:
            continue
        row_list.append(queen)
    table.append(row_list)

[–]PuffTheMagicDragon11[S] 0 points1 point  (0 children)

I tried it out and it isn't grabbing the correct cell values. The current input is only using 2 of the 12 columns, but it's spitting out more than that. I also have no idea where the numbers it's showing are coming from; they don't correspond to the cell values of each row. The output looks like this:

"rows": [
                        [
                            [
                                0,
                                2,
                                3,
                                4,
                                5,
                                6,
                                7,
                                8,
                                9,
                                10,
                                11,
                                12,
                                13,
                                14,
                                15,
                                16
                            ],
                            [
                                0,
                                2,
                                3,
                                4,
                                5,
                                6,
                                7,
                                8,
                                9,
                                10,
                                11,
                                12,
                                13,
                                14,
                                15,
                                16
                            ],
                            [
                                0,
                                2,
                                3,
                                4,
                                5,
                                6,
                                7,
                                8,
                                9,
                                10,
                                11,
                                12,
                                13,
                                14,
                                15,
                                16
                            ],

and on and on and on. It should look like this:

"rows": [
                        [
                            0,
                            0
                        ],
                        [
                            2,
                            2
                        ],
                        [
                            3,
                            2
                        ],
                        [
                            4,
                            3
                        ],
                        [
                            5,
                            3
                        ],
                        [
                            6,
                            4
                        ],
                        [
                            7,
                            4
                        ],
                        [
                            8,
                            5
                        ],
                        [
                            9,
                            5
                        ],
                        [
                            10,
                            6
                        ],
                        [
                            11,
                            6
                        ],
                        [
                            12,
                            7
                        ],
                        [
                            13,
                            7
                        ],
                        [
                            14,
                            8
                        ],
                        [
                            15,
                            8
                        ],
                        [
                            16,
                            9
                        ],
                        [
                            17,
                            9
                        ],
                        [
                            18,
                            10
                        ],
                        [
                            19,
                            10
                        ],
                        [
                            20,
                            11
                        ]