python写入excel文件太慢如何解决-解决python执行较大excel文件openpyxl慢问题

我就废话不多说了,大家还是直接看代码吧!

talk is cheap

from openpyxl import Workbook

from openpyxl.utils import get_column_letter

from openpyxl import load_workbook

import time

wb = load_workbook("E:/a.xlsx", read_only=True)

sh = wb["Sheet"]

# rowItem = {}

# for j in range(1,2000):

# for i in range(1, 30):

# rowItem[get_column_letter(i)] = i

# sh.append(rowItem)

# wb.save("E:/a.xlsx")

t0 = time.time()

print(sh['V500'].value)

t1 = time.time()

print("openpyxl所用时间:", str(t1-t0))

import xlrd

xlsPath = "E:/a.xlsx"

WorkBook = xlrd.open_workbook(xlsPath)

sh = WorkBook.sheet_by_name("Sheet")

t0 = time.time()

print(sh.cell(499,22).value)

t1 = time.time()

print("xlrd所用时间:", str(

你可能感兴趣的:(python写入excel文件太慢如何解决-解决python执行较大excel文件openpyxl慢问题)