# -*- coding: utf-8 -*-
import sys
import xlrd
import json
file = sys.argv[1]
#print(file)
data = xlrd.open_workbook(file)
table=data.sheets()[0]
nrows=table.nrows
#print(nrows)
ncols = table.ncols
#print(ncols)
returnData={}
for i in range(nrows ):
returnData[i]=table.row_values(i)
returnJson=json.dumps(returnData)
print(returnJson)
python 使用xlrd读取excel并返回json
最后更新 2018-05-17 08:00 星期四 所属:
Python教程 浏览:918
