There is no inverse function of cell.infer_value

Issue #704 invalid
Carlos Rivera
created an issue

That would be very useful. Otherwise it is impossible to recover the formatted value, for example:

ws['A1']='10%'     # internally this uses cell.infer_value
print (ws['A1'].value)
print (ws.['A1'].number_format)

But there is no way to obtain the string '10%' back. This is a problem when using openpyxl to read an excel file and trying to generate a CSV file where formatting should be applied (like excel does when saving to CSV).

Comments (6)

  1. CharlieC

    openpyxl does not provide this kind of functionality. Type inference itself is likely to be removed at some point with the responsibility passed entirely to client code.

  2. CharlieC

    No idea and it's likely to be very application specific. It should be easy enough to write your own for Excel as the number formats are extensively documented.

  3. Log in to comment