View difference between Paste ID: XqvZSRVJ and 3J65jHsc
SHOW: | | - or go back to the newest paste.
1
import os
2
import csv
3
import xlrd
4
5
with xlrd.open_workbook('Pilvetyybid_1968_Jõgeva.xls') as wb:
6
    sh = wb.sheet_by_index(0)  # or wb.sheet_by_name('name_of_the_sheet_here')
7
    with open('a_file.csv', 'w', newline='') as f:
8
        spamwriter = csv.writer(f, delimiter=';')
9
        c = csv.writer(f)
10
        
11
        for row in range(1,(sh.nrows)):
12
            for col in range(sh.ncols):
13
                if col ==0 or col>10:
14
                    row_should_be_written=False
15
                else:
16
                    row_should_be_written=True
17-
                    c.writerow(sh.row_values(row))
17+
            c.writerow(sh.row_values(row))