Import XLS\Import XLS. plugin xldr

plugin python, xldr

code:

import xlrd
file = system.file.openFile()
if file != None:
try:
book = xlrd.open_workbook(file,encoding_override="cp1251")
except:
book = xlrd.open_workbook(file)

worksheet = book.sheet_by_index(0)

rows=[]
for i in range(1,1000):
	
	try:
		linea=worksheet.cell(i,0).value 
		PuestoTrabajo=worksheet.cell(i,1).value
		
		oneRow = [linea,PuestoTrabajo]	
		rows.append(oneRow)
		
		print linea
		
	except:
		fila=i-1
		print 'Cantidad de filas importadas',' ',fila  
		break
headers = ["Linea" , " Puesto Trabajo" ]
		
data = system.dataset.toDataSet(headers, rows)
	
table = event.source.parent.getComponent('tb_dataPamco')
table.data = data

image

I don't see a specific question, but I think good general advice is to use the Apache POI library to manipulate import/export/manipulate data in Excel files.

A forum post on the issue:

1 Like

Except this post is flagged as 7.9 and I'm not sure that the Apache POI library was distributed with any 7.9 build. I would still probably opt for using Apache if I had it available though.

1 Like

Good point. I didn't catch that.

If 7.9 doesn't include them, you can still put the .jar files in the lib/core/common folder yourself, but it isn't as seamless.