从第3列第二个单元格开始

时间:2019-05-24 07:25:29

标签: excel python-3.x

现在,代码正在运行,但是它从第一个单元开始工作。我想从第二个单元格插入公式 [示例] [1]

    import openpyxl
    import os
    wb = openpyxl.load_workbook(r"type_e.xlsx")
    Sheet = wb.get_sheet_by_name('=0')
    for row,cellObj in enumerate(Sheet[3],1):
        cellObj.value='=IF(OR(B{0}="", B{0} ="", B{0} =""),"", IF(OR(B{0} ="", B{0} ="", B{0} ="", B{0}="", B{0} ="", B{0} ="", B{0} =""), "", ""))'.format(row)

简而言之,我已经使用过,这暂时对我有用

           Sheet.cell(row=1, column=3).value = 'type'
        #path to save file 
        wb.save(r'Documents\test6.xlsx')


  [1]: https://i.stack.imgur.com/tTSX8.png

0 个答案:

没有答案