Python Forum

Full Version: excel file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
I'm new in python and I want to ask

I have a .txt file with multiple lines, can I copy it to excel file line by line?

I searched all over the net and what I got is that lines from .txt file copied to excel to cell A1

thanks ahead,
yes, you can. there are several python libraries that deal with excel files - e.g. xlwriter (for xls files), openpyxl (for xlsx files), xlwings, etc.
In this case you will need to read csv file with tools from python standard library
Here is tutorial for openpyxl https://openpyxl.readthedocs.io/en/stable/tutorial.html
Also you can use pandas to read from csv and then dump to excel