Linefeed lost when assign value to cell

Issue #1183 invalid
Ming Yeh created an issue

To anyone whom may concern,

I'm working on a script used to export data from SQL Server to Excel. Most of features are working as expected, until I tried to assign the SQL script to a cell via openpyxl.

The code is quite straightforward:

#Save SQL script
sqlSheet = wb.create_sheet(title='SQL', index=1)
sqlSheet['A1'].value = sql

wb.save(fileName)
print('Data saved as ' + fileName)

There are some line feeds and tab characters in the SQL script, but lost when assign it to cell .

I think it might be useful to add a feature to retain the line feed and tab characters when assign a string value to cell.

Thanks so much for the effort on this brilliant library, It really helps!

Comments (2)

  1. Ming Yeh reporter

    Eh... Yes, you are right about this :) I rechecked my source code and tried another solution. Now it is working as expected. Thanks for you help anyway, Charlie.

    sql.png

  2. Log in to comment