[Tutor] How to read remote text file?

Steven D'Aprano steve at pearwood.info
Mon Mar 28 12:53:54 CEST 2011

Ratna Banjara wrote:
> Hey all,
> I need to read text file from remote server and generate excel file from
> local computer using python. Is it possible? If so how?

Possibly. Do you have access to the server? If so, you have to download 
the file using whatever protocol the server supports: http, https, ftp, 
gopher, something else.

Once you have copied the file, you can read the file and write it to a 
CSV file using the csv module. Excel can read CSV files. If you need an 
actual .xls file, this is a secret, proprietary format. There are some 
projects that have tried to reverse-engineer the format, like the xlrd 
package. Google for "excel python" and you will find about 13 million hits.


More information about the Tutor mailing list