my excel files have more than a 1000 numbers under the columns that are labeled x, y, z for each excel file. i was trying to print the x, y, and z values for all of the excel files in to a single excel file(Trying_excel.xls)that would have all of the numbers under the x,y,z column for all of the excel files. This is what i have so far...but it doesnt seem to work...
import xlrd
import os
path = "c:\\Hello\\RawTracking"
dirList=os.listdir(path)
f = open('C:\\Hello\\Other_files\\Trying_excel.xls', 'w')
f.write('Xvalue, Yvalues, Zvalue')
f.write("\n")
Col_values=[]
Col_values1=[]
Col_values2=[]
for file in dirList:
fullpath = os.path.join(path,file)
if os.path.isfile(fullpath) == 1:
wb = xlrd.open_workbook(fullpath)
wb.sheet_names()
sh = wb.sheet_by_name(u'RawTrackingData')
for j in range(21,sh.nrows):
Col_values.append(sh.cell(j,0).value)
Col_values1.append(sh.cell(j,1).value)
Col_values2.append(sh.cell(j,2).value)
a = Col_values
b = Col_values1
c = Col_values2
f.write(str(a))
f.write(", ")
f.write(str(b))
f.write(", ")
f.write(str(c))
f.write(", ")
f.write("\n")