Openpyxl:在每行中附加所有单元格值,然后插入到tkinter列表框中

时间:2018-08-22 13:09:34

标签: python tkinter openpyxl

我是python和stackoverflow的初学者。我已经导入了openpyxl和tkinter来做到这一点:

def cell_range():

global combinedCells
try:
    startRange = startingCell.get()
    endRange = endingCell.get()
    for rowOfCellObjects in chosenSheet[startRange:endRange]:
        for cellObj in rowOfCellObjects:
            stringValues = str(cellObj.value)
        combinedCells = []
        combinedCells.append('-'.join(stringValues for r1 in rowOfCellObjects))
        listbox4.insert(END, combinedCells)

except IndexError:
    pass

我想做这样的事情:How to combine one row's data into a single cell using Openpyxl

为什么我的列表框中显示Addie Ramirez-Addie Ramirez,而不是1-Addie Ramirez?我有两列,数字和名称。第一列似乎被忽略了。

我确实提到了这一点:https://automatetheboringstuff.com/chapter12/

谢谢!

0 个答案:

没有答案