from openpyxl import load_workbook
class RwExcelFile: def read_Excel(self,file_path):
'''
读取excel中所有数据并以列表形式返回
:param file_path:
:return:
'''
excel_File = load_workbook(file_path)
sheet_names = excel_File.sheetnames
list_column = []
list_row = []
list_sheet = []
for i in sheet_names:
excel_File_sheet=excel_File[i]
for j in range(1,excel_File_sheet.max_row+1):
for k in range(1,excel_File_sheet.max_column+1):
list_column.append(excel_File_sheet.cell(j,k).value)
list_row.append(list_column)
list_column = []
list_sheet.append(list_row)
list_row = []
excel_File.close()
return list_sheet def write_Excel(self,file_path,sheetname,row,cloumn,T_value):
'''
向excel指定位置写入值
:param file_path: 文件地址
:param sheetname: sheet名
:param row: 行
:param cloumn:列
:param T_value: 值
:return: 无返回
'''
excel_File = load_workbook(file_path)
excel_File[sheetname].cell(row,cloumn,T_value)
excel_File.save(file_path)
excel_File.close()

最新文章

  1. tomcat 远程调试
  2. 支付宝即时到账API,网站收到回调页面,输出验证失败,log中responseTxt=错误的问题
  3. Anywhere服务建立及连接步骤
  4. 用 Docker 快速配置前端开发环境
  5. Android 开发技巧
  6. C#多线程问题整合
  7. iOS校验身份证是否合法
  8. 深刻理解iosBlock
  9. 02_3中方式的反射,通过Class.forName获得Class对象,通过类.class获得字节码对象,通过类实例.getClass()的方式获得Class对象
  10. [CC-BSTRLCP]Count Binary Strings
  11. javaMail实现收发邮件(一)
  12. 有向连通图增加多少边构成强联通(hdu3836,poj1236)
  13. FastAdmin 环境变量 env 配置
  14. HDU 4762 Cut the Cake(高精度)
  15. LINUX 查找替换命令 总结
  16. 反编译示例:mxd检查
  17. zabbix自定义key监控redis
  18. webpack中多模块依赖
  19. Node-sqlite3多字段插入数据问题
  20. 基于flask做权限控制

热门文章

  1. 百度在职 iOS 架构师的成长笔记,送给还在迷茫的你!
  2. GDB使用记录
  3. MySql实现分页查询的SQL,mysql实现分页查询的sql语句 (转)
  4. 常见RPC开源框架
  5. LaTeX技巧561:LaTeX如何让每一章带有目录?
  6. [Everyday Mathematics]20150305
  7. 散度、旋度与 Laplacian
  8. 《11招玩转网络安全》之第一招:Docker For Docker
  9. Java CAS 比较并且更换值
  10. 边框回归(bounding-Box regression)