Use style of column for new cells in openpyxl
问题 Assume that that there is an existing .xlsx file with specified column styles. As a minimal example create an empty sample.xlsx file and by clicking at column A set its number style to Percent (in contrast to default General ). Now, execute the following code import openpyxl as pyxl import math sample = 'sample.xlsx' new = 'sample_new.xlsx' wb = pyxl.load_workbook(sample) ws = wb.active ws['A1'] = math.pi print 'Cell format is %s' % ws['A1'].number_format wb.save(new) The output of the print