Insert row into Excel spreadsheet using openpyxl in Python

前端 未结 11 2291
既然无缘
既然无缘 2020-11-28 15:09

I\'m looking for the best approach for inserting a row into a spreadsheet using openpyxl.

Effectively, I have a spreadsheet (Excel 2007) which has a header row, foll

11条回答
  •  执念已碎
    2020-11-28 15:34

    Unfortunately there isn't really a better way to do in that read in the file, and use a library like xlwt to write out a new excel file (with your new row inserted at the top). Excel doesn't work like a database that you can read and and append to. You unfortunately just have to read in the information and manipulate in memory and write out to what is essentially a new file.

提交回复
热议问题