trytryhard

xlsx to csv

Nov 20th, 2022
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1.  
  2. import time
  3. import os
  4. import pandas
  5.  
  6.  
  7. print("(full)path to list of files/folders:")
  8. path_to_f=str(input())
  9.  
  10. book = pandas.read_excel(path_to_f)
  11.  
  12. header=";".join(book.head())
  13. result_name = "result_"+str(time.time())+".csv"
  14. result_file = open(result_name,"w",encoding='utf-8-sig')
  15. result_file.write(header+'\n')
  16.  
  17. for i in range (book.shape[0]):
  18.     for j in range(book.shape[1]):
  19.         list_help = str(str(book.iloc[i,j]))
  20.         result_file.write(list_help+'\n')
  21.  
  22. result_file.close()
  23.  
Advertisement
Add Comment
Please, Sign In to add comment