Advertisement
Guest User

Untitled

a guest
May 12th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import os
  2. import xlrd
  3. import pandas as pd
  4. from xlrd import open_workbook
  5. from xlwt import Workbook
  6.  
  7.  
  8. rb = open_workbook('Pilvetyybid_1966_Parnu.xls',formatting_info=False)
  9.  
  10. for a, name in enumerate(rb.sheet_names()):
  11. rs = rb.sheet_by_index(a)
  12. new_book = Workbook()
  13. new_sheet = new_book.add_sheet('Sheet 1')
  14.  
  15. for col in range(rs.ncols):
  16. if col ==0 or col>10:
  17. pass
  18. else:
  19. for row in range (rs.nrows):
  20. #rs.row_slice(row,start_colx=1, end_colx=10)
  21. if row == 0:
  22. pass
  23. else:
  24. new_sheet.write(row, col, rs.cell(row, col).value)
  25.  
  26.  
  27. new_book.save(jaamanimi + ".xls")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement