Python办公自动化 | EXCEL读取和写入
2021-04-25 11:27
标签:pen pycha learn div book open port sheet int Python办公自动化 | EXCEL读取和写入 标签:pen pycha learn div book open port sheet int 原文地址:https://www.cnblogs.com/mba1398/p/13258732.html 1 import xlrd
2 import xlwt
3
4
5 xlsx = xlrd.open_workbook(r‘D:\pycharm\learning\autowork\test.xlsx‘)
6 table = xlsx.sheet_by_index(0)
7 # table = xlsx.sheet_by_name(‘Sheet1‘)
8 print(table.cell_value(0, 0))
9 print(table.cell(0, 0).value)
10 print(table.row(0)[0].value)
11
12 new_workbook = xlwt.Workbook()
13 new_sheet = new_workbook.add_sheet(‘aaa‘)
14 new_sheet.write(1, 1, ‘hello word‘)
15 new_workbook.save(r‘D:\pycharm\learning\autowork\test2.xls‘)
下一篇:13个不low的JS数组操作
文章标题:Python办公自动化 | EXCEL读取和写入
文章链接:http://soscw.com/index.php/essay/79366.html