This is the xls file :
moto 5 2 45
moto 2 4 43
coche 8 54 12
coche 43 21 6
coche 22 14 18
And this is the code working with pyexcel library:
import pyexcel as pe
data = pe.get_sheet(file_name="vehiculo.xls")
sheet = pe.Sheet(data, name_rows_by_column=0)
sheet.row.select(['coche'])
sheet.save_as("output.xls")
it returns only the fisrt row with name 'coche':
coche 8 54 12
And I want all the rows with the name "coche".
Any idea? Thanks
My apology for the fact that the function 'select' didn't work as intended. It didn't work because the rest of the row becomes coche-1, coche-2(you can check it out by print(s)
). This is the default behaviour on row names that has the same name. Will change in the future.
For now, to get your use case to work, you can use pyexcel==0.3.0+ with this statement:
...
>>> sheet = pe.Sheet(data) # , name_rows_by_column=0)
>>> del sheet.row[lambda row_inde,row: row[0] != 'coche']
...
Here is the documentation on this functionality.