from openpyxl import load_workbook
import os
import sys
def Xlsx2List(dir):
files = os.listdir(dir)
for file in files:
if file.lower().endswith('.xlsx') == False:
continue
print "analyze file %s" %file
wb = load_workbook(filename = os.path.join(dir,file))
sheets = wb.get_sheet_names()
for sheetName in sheets:
sheet_ranges = wb.get_sheet_by_name(name = sheetName)
if sheet_ranges != None:
print "analyze sheet %s" %sheetName
rowNum = 0
outputList = []
while(True):
desci = sheet_ranges.cell(row=rowNum, column=0).value
pkg = sheet_ranges.cell(row=rowNum, column=1).value
if pkg == None or len(pkg) == 0:
bre
使用openpyxl读取xlsx文件
最新推荐文章于 2024-04-23 22:12:05 发布
这篇博客介绍了如何利用openpyxl库读取和处理xlsx文件,适合初学者入门。
摘要由CSDN通过智能技术生成