现在,代码正在运行,但是它从第一个单元开始工作。我想从第二个单元格插入公式 [示例] [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