How to write/update data into cells of existing XLSX workbook using xlsxwriter in python

后端 未结 5 824
说谎
说谎 2020-12-01 04:47

I am able to write into new xlsx workbook using

import xlsxwriter  
def write_column(csvlist):
    workbook = xlsxwriter.Workbook(\"filename.xlsx\",{\'strin         


        
5条回答
  •  隐瞒了意图╮
    2020-12-01 05:09

    you can use this code to open (test.xlsx) file and modify A1 cell and then save it with a new name

    import openpyxl
    xfile = openpyxl.load_workbook('test.xlsx')
    
    sheet = xfile.get_sheet_by_name('Sheet1')
    sheet['A1'] = 'hello world'
    xfile.save('text2.xlsx')
    

提交回复
热议问题