Python处理excle
流程
读取表格
35.png- 读取excle表格内容
import xlrd
xlsx = xlrd.open_workbook('D:/python_work/excle/test-r.xlsx')
table = xlsx.sheet_by_index(0)
print(table.cell_value(5, 0))
print(table.cell(5, 0).value)
print(table.row(5)[0].value)
- 写入表格
import xlwt
new_workbook = xlwt.Workbook()
worksheel = new_workbook.add_sheet("new_test")
worksheel.write(0, 0, 'test')
new_workbook.save('D:/python_work/excle/test.xls')
网友评论