openpyxl - Why is my python code inserting empty lines in excel -
i supposed make 1 excel file out of two. went ok except making new file. give smart people code, please me it. wrong? after insert rows in file want + empty rows randomly around file. checked arrays before getting szuk.f_same() problem have in writing file part... can't find it. again... please me guys ..
wb = openpyxl.workbook() ws = wb.create_sheet("wyniki",0) h = 0 in range(0,len(dat1[0])): # znajdz odpowiadajace!!! = szuk.f_same( [ dat1[0][i], dat1[1][i], dat1[2][i] ], dat2 ) j in range(0,len(a[0])): #print( '\n \n h=' + str(h) + ' \n \n \n j=' + str(j) ) k in range(0,len(a)): cel = f(k+1) + str(j+1+h) wb[wb.get_sheet_names()[0]][cel].value = a[k][j] print(a[k][j]) h+=1 wb.template = false wb.save('gotowe.xlsx')
this funk used order data:
def f_same( wzor, dane, por_wzor = [ 0, 2 ] , por_dane = [ 0 , 1 ] ): if( len(por_wzor) len(por_dane) ): wynik = [] in range(0, len(wzor)+len(dane)-len(por_dane)): wynik.append([]) pom = [[], []] in range(0,len(por_wzor)): pom[0].append(por_wzor[i]) pom[1].append(por_dane[i]) #...................................................................... in range(0,len(dane[0])): if( wzor[pom[0][0]] + wzor[pom[0][1]] == dane[pom[1][0]][i] + dane[pom[1][1]][i] ): wynik[0].append(wzor[0]) wynik[1].append(wzor[1]) wynik[2].append(wzor[2]) wynik[3].append(dane[2][i]) wynik[4].append(dane[3][i]) wynik[5].append(dane[4][i]) return wynik
as last info:
i changed 1 line in write file openpyxl function. replaced normal file file.write() , worked. confirmed problem library. till useing it, geting data out of excel sheet worked. recomend not use it...
i send regards charlie clark defencive lib.
wiki
Comments
Post a Comment