Today I have a new problem so I hope that everybody can help me. My problem is export data from textedit to excel file using python 3. I had found many documents but all of them can not help me. Please give me some helps :)
Asked
Active
Viewed 201 times
-1
-
I guess you are looking for converting your file into an excel https://stackoverflow.com/questions/17684610/python-convert-csv-to-xlsx – Raja G Nov 16 '17 at 08:19
-
No, I don't. I want to save text to excel file. The text is recognize from image. I use pytesseract library to recognize text, it includes name, phone number, email, website then I have to save the text to excel file like: Name: abc, Phone number: 0123, Email: example@gmail.com – Tam Nguyen Nov 16 '17 at 08:33
-
This is an image about my prject https://i.stack.imgur.com/N5QgO.png – Tam Nguyen Nov 16 '17 at 08:45
-
Before trying to save the information in an excel you must separate the information where you have Name, Phone Number, Email separately since as I assume the images that you process do not have an established format. – eyllanesc Nov 16 '17 at 13:50
1 Answers
0
If your data is regular, then the problem will be simple.
For example: If every line has":",you can catch it with regular expressions":". Then, Insert the character before and after the colon into a dictionary.
something like:
{date:2017-11-16, time:17:09, ......}
finally, use xlrd and xlwt.
you can easily export data from python dictionary to excel using xlrd and xlwt.
But, if your data is random. It's too difficult, and I don't have a good way,either.

Sam L
- 28
- 3
-
my project is use ocr to recognize text from image, the text is Vietnamese, then I have to save the text to excel file like: fullname: abc, phone number: 01234,... – Tam Nguyen Nov 16 '17 at 08:30