Skip to content Skip to sidebar Skip to footer

Setting Values In Openpyxl Load_workbook, Use_iterators

I want to read a xlsx file, change all the values less than say 0.0001 to 0.01. I can read the values and print them, but I can't change them ? import pylab from openpyxl import

Solution 1:

from the documentation : http://pythonhosted.org/openpyxl/api.html

 openpyxl.reader.excel.load_workbook(filename,use_iterators=False)[source] :
Open the given filename andreturn the workbook
Parameters:   

    filename (string) – the path to open
    use_iterators (bool) – use lazy loadfor cells

Return type:  
    openpyxl.workbook.Workbook

When using lazy load, all worksheets will be openpyxl.reader.iter_worksheet.IterableWorksheet and the returned workbook will be read-only.

don't use use_iterators=True . Also, if you need to call .save(filename) if you want to update the xlsx with your new values.

Post a Comment for "Setting Values In Openpyxl Load_workbook, Use_iterators"