用Python读取Excel(*.xls)文件——xlrd模块的使用
来源:互联网 发布:淘宝卖家如何推广产品 编辑:程序博客网 时间:2024/06/05 04:27
使用 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 Nonenrows = sh.nrowsncols = sh.ncolsprint "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(*.xls)文件——xlrd模块的使用
- 用python处理Excel文档(1)——用xlrd模块读取xls/xlsx文档
- python读取excel文件—xlrd
- python读取excel表格——xlrd的使用
- python使用xlrd模块读写Excel文件的方法
- python使用xlrd模块读写Excel文件的方法
- python模块:xlsxwriter和xlrd相结合读取、写入excel文件
- python使用xlrd模块对excel进行读取
- 用Python处理Excel——xlrd的简单使用
- python的xlrd模块(读取excel表格)
- python之使用xlrd模块读取表格文件
- python使用xlrd模块读取xlsx文件中的ip
- xlrd---Python中读取excel文件的利器
- xlrd---Python中读取excel文件的利器
- 使用python的xlrd模块解析excel的多级结构
- python 用xlrd及xlutils模块 复制excel文件
- python中xlrd模块导入Excel文件
- Python中xlrd、xlwt、win32com模块对xls文件的读写操作
- 移植Linux操作系统时候遇到的问题
- Node.js 究竟是什么?
- Delphi 获取当前目录
- hdu 2063(过山车)
- Debian 7解决中文乱码
- 用Python读取Excel(*.xls)文件——xlrd模块的使用
- Python关闭窗体时释放资源
- 【转贴】gdb中的信号(signal)相关调试技巧
- lsof 详解
- 跟visual studio 集成的git插件
- hdc的初始化操作由case标签跳过
- 哈弗曼二叉树的C简单实现
- VC6命令行编译配置
- POJ 1753 Flip Game 枚举