python读写Excel文件
来源:互联网 发布:知无涯者百度云资源 编辑:程序博客网 时间:2024/05/27 14:12
python脚本处理excel文件很方便
1.读excel文件,需要安装xlrd(pip install xlrd)
import xlrd
使用方法book = xlrd.open_workbook(fname)打开excel表格
sh = book.sheet_by_name(sheetname)获取sheet
nrows = sh.nrows获取行数
ncols = sh.ncols获取列数
cell_val = sh.cell_value(i,j)获取单元格i行j列数据
sh.row_values(i) 获取第i行数据
sh.col_value(j)获取第j列数据
参考链接
http://www.jb51.net/article/42635.htm
2写excel文件,需要安装pyExcelerator(pip install pyExcelerator)
form pyExcelerator import *
book = Workbook() #创建工作簿
sheet = w.add_sheet(sheetname) #创建工作表
sheet.write(i,j)#在单元格第i+1行j+1列写入数据
book.save("mybook.xls") #保存文件,注意必须是book而不是sheet.save()
0 0
- 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文件
- python-23-读写excel文件
- python之读写excel文件
- andriod studio 部分快捷键
- DataGrid easyui json
- HTML-块和类
- macbook pro chrome 开发者模式快捷键
- 简单链表与期末复习
- python读写Excel文件
- 泛型
- Mongoose学习参考文档
- 【EmbeddedDev】通过mmap方法访问ADC/GPIO
- Explicit Constructors(显式构造函数)收藏
- 跟我一起写 Makefile(六)
- Debug日记输出正常,html页面乱码问题
- 【操作记录】CentOS编译安装mysql
- jdk动态代理参数理解