I have a file that is really in csv format but is being handed to me as a .txt. I need to take this file and transfer it to .xls format so I can upload it into Google Docs. Currently I have the code below but it is spitting out the file with everything on the line into the first cell instead of breaking out different cells for every comma value. Does anyone know how to solve this?
Thanks!
import os
fin = open(r"C:\Users\JohnDoe\Downloads\Report.txt", "r")
data_list = fin.readlines()
fin.close() # closes file
fout = open(r"C:\Users\JohnDoe\Desktop\Report.xls", "w")
fout.writelines(data_list)
fout.flush()
fout.close()
xlsas Google Docs can certainly handle a.csv. If my assumption that you don't actually need a.xlsis wrong, let me know.