python向EXCEL添加一列数据或指定行列给单元格赋值

import openpyxl

# column名
column_title = ["FirstName", "LastName"]

if __name__ == '__main__':
    """
    CELL放入值
    """
    wb = openpyxl.load_workbook('example.xlsx')
    ws = wb.active

    # 指定行列给单元格赋值
    ws.cell(row=4, column=6, value=100)

    # 保存
    wb.save('example.xlsx')

你可能感兴趣的:(python)