Python实操使用end或expand汇总sheet数据

import xlwings as xw
wb = xw.Book(r'E:\Python\Project2.xlsx')
data = []
# for sh in wb.sheets:
#     if '汇总' != sh.name:
#         brr = []
#         brr = sh.range('a2').expand().value
#         data += brr

# wb.sheets.add('汇总', before=1).range('a1').value = data

for sh in wb.sheets:
    if '汇总' != sh.name:
        print(sh.range('a65536').end('up').row)
        brr = []
        num = str(sh.range('a65536').end('up').row)
        brr = sh.range('a1:e'+num).value
        data += brr

wb.sheets.add('汇总', before=1).range('a1').value = data

你可能感兴趣的:(Python,前端,javascript,linux)