Excel showing empty cells when importing file created with csv module

徘徊边缘 提交于 2019-12-12 04:11:32

问题


I have a .csv with rows that are something like:

"Review",Clean Review
"The hotel _was, re3ally good",the hotel was really good

but when I was open with excel 2013 the cells with the double quotes are showing empty on the sheet, and I can only see the text in the formula bar. Can anyone tell me why this is happening?

excel sheet kinda looks like:

|          |Clean Review|
|          |the hotel wa|

I have opened the .csv in notepad and there doesn't seem to be hidden characters causing this behavior

I used Python's csv module to create the .csv

it especially happens if you drag and expand the first column


回答1:


The problem is in your CSV file. There is a CR after the w in Review. And Review is actually on the 2nd line of A1 (seen if you increase the height of row 1).

Here is an analysis of the characters at the beginning of your actual CSV with the character and the ASCII code. Note the 10 after the w

"              34 
R              82 
e              101 
v              118 
i              105 
e              101 
w              119     
               10 
"              34 



回答2:


Try

="Review",Clean Review
="The hotel _was, re3ally good",the hotel was really good

This forces the value to be text and not something else. Haven't tried but theoretically should work.

Please check this and more solutions here



来源:https://stackoverflow.com/questions/43575973/excel-showing-empty-cells-when-importing-file-created-with-csv-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!