Guest User

Untitled

a guest
Jan 12th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import sys, os, xlrd, csv, codecs
  3. xlsFileName = sys.argv[1]
  4. csvFileName = xlsFileName + '.csv'
  5. columnsTotalCout = int(sys.argv[2])
  6. print columnsTotalCout
  7.  
  8. if os.path.exists(xlsFileName):
  9. book = xlrd.open_workbook(xlsFileName)
  10. sh = book.sheet_by_index(0)
  11. f = codecs.open(csvFileName, "wb", "utf-8")
  12. #csvFile=csv.writer(open(csvFileName, 'wb'), delimiter="\t")
  13. csvFile=csv.writer(f , delimiter="\t")
  14.  
  15. for rownum in range(sh.nrows):
  16. print sh.row_values(rownum)[:columnsTotalCout][3]
  17. #f.write(sh.row_values(rownum)[:columnsTotalCout][3]);
  18. csvFile.writerow(sh.row_values(rownum)[:columnsTotalCout][3])
  19. exit();
Add Comment
Please, Sign In to add comment