Python:利用openpyxl库,将sorce.xlsx的数据复制到target.xlsx
生活随笔
收集整理的這篇文章主要介紹了
Python:利用openpyxl库,将sorce.xlsx的数据复制到target.xlsx
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Ps:給自己留的備份,以后不想寫不想查不想百度不想問了。
import openpyxl wb_ini = openpyxl.load_workbook('source.xlsx') ws_ini = wb_ini.active#逐行讀取source文件的數據 content = [] for row in ws_ini.rows:tmp_list = []for cell in row:tmp_list.append(cell.value)content.append(tmp_list)wb_wrt = openpyxl.Workbook() ws_wrt = wb_wrt.active for item in content:ws_wrt.append(item) wb_wrt.save('target.xlsx')總結
以上是生活随笔為你收集整理的Python:利用openpyxl库,将sorce.xlsx的数据复制到target.xlsx的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【转】ultraedit 正则表达式
- 下一篇: Khan公开课 - 统计学学习笔记 (四