import xlsxwriter
#todo 创建excel文件
xl = xlsxwriter.Workbook('/Users/edz/Desktop/test.xlsx')
#todo 添加sheet
sheet = xl.add_worksheet('sheet1')
#todo 往单元格cell添加数据,索引写入
sheet.write_string(0, 1, 'username1')
#todo 位置写入
sheet.write_string('B1', 'password')
#todo 设置单元格宽度大小
sheet.set_column('A:B', 30)
#todo 关闭文件
xl.close()
python实现Excel文件数据写入
最新推荐文章于 2024-01-12 16:07:46 发布