用Python读取Excel(*.xls)文件——xlrd模块的使用
2013-08-30 08:38
1001 查看
使用 xlrd 能够很方便的读取 excel 文件内容,而且这是个跨平台的库,能够在windows,linux/unix,等平台上面使用。
软件可以去这个地址http://www.lexicon.net/sjmachin/xlrd.htm下载。
详细的xlrd模块帮助在他的主页上http://www.lexicon.net/sjmachin/xlrd.html
如果想彻底研究excel的话,这边有讲解excel格式的文档:
http://sc.openoffice.org/excelfileformat.pdf
软件可以去这个地址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
相关文章推荐
- python读写Excel文件--使用xlrd模块读取,xlwt模块写入
- Python使用xlrd读取Excel格式文件的方法
- python之使用xlrd模块读取表格文件
- Python 使用 xlrd 读取 Excel格式文件
- Python 使用 xlrd 读取 Excel格式文件
- Python使用xlrd读取Excel格式文件的方法
- 用python处理Excel文档(1)——用xlrd模块读取xls/xlsx文档
- Python 使用 xlrd 读取 Excel格式文件
- python---文件保存xls格式,xlwt,xlrd的模块使用
- python使用xlrd模块对excel进行读取
- 使用Python xlrd与xlwt模块读写Excel
- Python使用xlrd模块操作Excel数据导入的方法
- Python 读取excle文件所有内容[xlrd模块]
- python读取excel文件—xlrd
- python使用xlrd读取excel数据时,整数和日期变小数的解决办法
- 【python】如何批量读取文件夹的所有文件数据,os模块与open函数结合使用实例
- python使用xlwt读取文件写入Excel
- C# —— 使用C# NPOI 读取Excel(.xls)文件
- 使用python读取.txt文件并保存到Excel中
- Python读取文件及安装读取Excel模块