Trailing spaces in text are lost when reading workbook being previously saved

Issue #458 resolved
Alexander Vinnikov
created an issue

xml:space attribute is written to <si> element while reader expects it in text element <t> This attribute is expected to be scoped to child elements. Excel 2010 writes the attribute to <t> element.

Comments (7)

  1. Alexander Vinnikov reporter

    Here is sample code:

    import openpyxl
    sample_string = 'String with trailing space '
    wb = openpyxl.Workbook()
    ws =
    ws['A1'] = sample_string'test_trailing_space.xlsx')
    wb = openpyxl.load_workbook('test_trailing_space.xlsx')
    ws =
    assert ws['A1'].value == sample_string
  2. Log in to comment