Skip to content

Commit

Permalink
Modifico _read_xlsx para que use sheet_to_table en vez de su funcion …
Browse files Browse the repository at this point in the history
…custom
  • Loading branch information
capitantoto committed Jan 9, 2017
1 parent 490b5d4 commit cee028c
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pydatajson/pydatajson.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,16 +758,7 @@ def _read_csv(path):
def _read_xlsx(path):
workbook = pyxl.load_workbook(path)
worksheet = workbook.active

# Asumo que la primera fila contiene los encabezados
keys = [cell.value for cell in worksheet.rows[0]]
# Compruebo que todas las filas sean tan largas como la de encabezados
# Esto puede fallar cuando una celda de excel fue usada y luego borrada
# porque cuenta como
assert all([len(keys) == len(row) for row in worksheet.rows])

table = [dict(zip(keys, [cell.value for cell in row]))
for row in worksheet.rows[1:]]
table = xlsx_to_json.sheet_to_table(worksheet)

return table

Expand Down

0 comments on commit cee028c

Please sign in to comment.