Python openpyxl 用法

    技术2025-08-15  15

    from openpyxl import Workbook wb = Workbook() # 抓取活跃的工作表 sheet = wb.active # 命名工作表 sheet.title = '练习表' # 某个表格中赋值数据 sheet['A1'] = '练习需要' # 表格添加行内容 list = [1,2,3,4,5] sheet.append(list) # 在某个表格中输入当前时间 import datetime sheet['A2'] = datetime.datetime.now() # 保存该文件 wb.save("test_document.xlsx")

     

    Processed: 0.014, SQL: 9