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

user2787436 picture user2787436 · Sep 17, 2013 · Viewed 141.9k times · Source

I am able to write into new xlsx workbook using

import xlsxwriter  
def write_column(csvlist):
    workbook = xlsxwriter.Workbook("filename.xlsx",{'strings_to_numbers': True})
    worksheet = workbook.add_worksheet()
    row = 0
    col = 0
    for i in csvlist:
        worksheet.write(col,row, i)
        col += 1

    workbook.close() 

but couldn't find the way to write in an existing workbook. Please help me to write/update cells in existing workbook using xlswriter or any alternative.

Answer

alecxe picture alecxe · Sep 17, 2013

Quote from xlsxwriter module documentation:

This module cannot be used to modify or write to an existing Excel XLSX file.

If you want to modify existing xlsx workbook, consider using openpyxl module.

See also: