python 读取excel
来源:互联网 发布:淘宝分销平台供应商 编辑:程序博客网 时间:2024/05/01 03:14
使用 xlrd 能够很方便的读取 excel 文件内容,而且这是个跨平台的库,能够在windows,linux/unix,等平台上面使用。
软件可以去这个地址http://www.lexicon.net/sjmachin/xlrd.htm下载。
- import xlrd
- fname = "sample.xls"
- bk = xlrd.open_workbook(fname)
- shxrange = range(bk.nsheets)
- try:
- sh = bk.sheet_by_name("Sheet1")
- except:
- print "no sheet in %s named Sheet1" % fname
- return None
- nrows = sh.nrows
- ncols = sh.ncols
- print "nrows %d, ncols %d" % (nrows,ncols)
- cell_value = sh.cell_value(1,1)
- print cell_value
- row_list = []
- for i in range(1,nrows):
- row_data = sh.row_values(i)
- row_list.append(row_data)
详细的xlrd模块帮助在他的主页上http://www.lexicon.net/sjmachin/xlrd.html
如果想彻底研究excel的话,这边有讲解excel格式的文档:
http://sc.openoffice.org/excelfileformat.pdf
0 0
- python读取excel
- python 读取excel --zhaokuo719
- python 读取excel
- python读取EXCEL
- python读取excel
- python 读取Excel
- Python excel文件读取
- 用python读取excel
- Python 读取excel
- python读取excel文件
- python读取excel文件
- python 读取不规则excel
- python读取excel数据
- python读取excel数据
- python 读取excel数据
- python读取excel文件
- python读取excel数据
- python读取Excel
- 7月书讯:最是那一低头阅读的温柔
- EEPlat的元数据驱动的执行引擎
- Properties保存程序配置
- django学习笔记(高级视图-支持验证)
- Ansible@一个高效的配置管理工具--Ansible configure management--翻译(九)
- python 读取excel
- Logback浅析
- mysql中间件研究(Atlas,cobar,TDDL)
- storm学习笔记
- jquery 计算报价多个框联动
- oracle: set currval of sequenct
- 单点接地
- 【模拟】poj1207 The 3n + 1 problem
- 文件删除问题总结