← Back to team overview

sikuli-driver team mailing list archive

[Question #241157]: assigning second row of data to the first row of header names using excel data in sikuli

 

New question #241157 on Sikuli:
https://answers.launchpad.net/sikuli/+question/241157

Hi Raiman,

Trying to reading excel data in sikuli which I can.
But I would like to assign the data from second row to the first row which is not accepting.
Here in the below example first row values in the excel  are testfile, outfile, firtstpages, otherpages, source and second row onwards
a4, AO1,d1,d1,auto
a3,AO2,d3,d3,bypass

When I do below way it is working, but I don't want to enter column cell increment for each parameter, instead is there a way to keep the first row constant and only passing data from second row to first row parameters

	#print testcase
	testfile=worksheet.cell_value(curr_row, cell)
	outputfile=worksheet.cell_value(curr_row, cell+1)
	firstpages=worksheet.cell_value(curr_row, cell+2)
	otherpages=worksheet.cell_value(curr_row, cell+3)
	source=worksheet.cell_value(curr_row, cell+4)


Please see my below steps


workbook = xlrd1.open_workbook('C:\\Documents and Settings\\admin\\Desktop\\python\\book1.xls')
worksheet = workbook.sheet_by_name('Sheet1')
num_rows = worksheet.nrows - 1
num_cells = worksheet.ncols - 1
curr_row = 0
header_row = curr_row
curr_row = 1
while curr_row <= num_rows:
	
	row = worksheet.row(curr_row)
	print 'Row:', curr_row
                 

                '''
                 testfile=worksheet.cell_value(curr_row, cell)
	outputfile=worksheet.cell_value(curr_row, cell+1)
	firstpages=worksheet.cell_value(curr_row, cell+2)
	otherpages=worksheet.cell_value(curr_row, cell+3)
	source=worksheet.cell_value(curr_row, cell+4
                '''
	cell=0
	
	while cell <= num_cells:
		#worksheet.cell_value(header_row,cell)=worksheet.cell_value(curr_row, cell)
		
		
		a=worksheet.cell_value(header_row,cell)
		b=worksheet.cell_value(curr_row, cell)
		
		print a
		print b
		print "worksheet.cell_value(header_row,cell)=worksheet.cell_value(curr_row, cell)"
		a=b
		cell += 1
	
with the above steps getting error message "syntax error as "no viable alternative  at input value"
So please guide us how can I assign the data from second row to first row.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.