Python Forum
Python outputs to Excel - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Python outputs to Excel (/thread-41126.html)



Python outputs to Excel - NewBiee - Nov-15-2023

Hi,

I don't even know how to describe my problem but I'll try. I receive the same .txt file and my python code computes it and then outputs .csv. But this time I have a problem with my output, some of the column's data is too large and it goes over the next row, to my .csv files format is out of order.

E.G
Output:
Filename Clean vvs_000.txt From: this person > Sent: Wednesday s reviewed. Regards vvs_001.txt See this person I told you
The data in the Clean column is too late that "s reviewed. Regards" goes over to a new row.


RE: Python outputs to Excel - buran - Nov-15-2023

Have a look at the input file. There is no such thing as too long/large. There is a new line/carriage return in the input
Of course, without seeing your code, it's also possible that you add new line somehow
Unless you show sample input and your code it's hard to tell more


RE: Python outputs to Excel - RockBlok - Nov-24-2023

Are you writing a lot of information to a single cell? There is a character limit on excel csvs per cell.


RE: Python outputs to Excel - DPaul - Nov-26-2023

Hi,
There are many reasons why things like that happen.
I usually encounter the reverse: problem: from excel going to csv.
What I do is perform some checks first.
1) Is every line terminated by a "\n", also the broken lines ?
2) If it is a csv, should there be the same number of separators "," on every line ? => count.
3) Is there something you can recognise the last element of a line with ?
4) Is the csv computer generated or did somebody type it manually?
etc...
Paul