一、读取大Excel文件内容
# -*- coding: utf-8 -*-
"""
Created on Sat May 4 15:50:34 2019
@author: 86183
"""
#读取非常大的Excel文件,只读不编辑
from openpyxl import load_workbook
wb=load_workbook(filename='lage.xlsx', read_only=True)
ws=wb['big_data']
for row in ws.rows:
for cell in row:
print(cell.value)
二、检查工作表外观尺寸,行列数(ws.reset_dimensions() 重置外观大小)
# -*- coding: utf-8 -*-
"""
Created on Sat May 4 15:50:34 2019
@author: 86183
"""
#检查工作表外观尺寸,行和列数
from openpyxl import load_workbook
import openpyxl
wb=load_workbook(filename='empty_book.xlsx')
ws=wb['range name']
cal=ws.calculate_dimension() #检查工作边外观尺寸,行和列数
print(cal)
三、只写模式,表格格式,备注
在只写模式中只能使用append()添加行
# -*- coding: utf-8 -*-
"""
Created on Sat May 4 15:50:34 2019
@author: 86183
"