mkasa / json2xlsx

A tool to generate xlsx (Excel Spreadsheet) files from JSON files
30 stars 12 forks source link

ValueError: Invalid column index 0 #2

Closed flutesa closed 8 years ago

flutesa commented 9 years ago

Masahiro Kasahara, thx you for nice project!

I catch with this:

flutesa@flutesa:~/Documents/mongoExport$ json2xlsx fields.ts -l -j avito.json -o avito.xlsx
Traceback (most recent call last):
  File "/usr/local/bin/json2xlsx", line 9, in <module>
    load_entry_point('json2xlsx==1.2.5', 'console_scripts', 'json2xlsx')()
  File "/usr/local/lib/python2.7/dist-packages/json2xlsx/utilities/json2xlsx.py", line 477, in main
    main_real()
  File "/usr/local/lib/python2.7/dist-packages/json2xlsx/utilities/json2xlsx.py", line 458, in main_real
    render(workbook, cursor, y_size, x_size, render_state, [render_state['current_table']])
  File "/usr/local/lib/python2.7/dist-packages/json2xlsx/utilities/json2xlsx.py", line 193, in render
    cell = current_sheet.cell(row = cursor[0], column = cursor[1])
  File "/usr/local/lib/python2.7/dist-packages/openpyxl/worksheet/worksheet.py", line 312, in cell
    coordinate = '%s%s' % (get_column_letter(column), row)
  File "/usr/local/lib/python2.7/dist-packages/openpyxl/compat/functools.py", line 122, in wrapper
    result = user_function(*args, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/openpyxl/cell/cell.py", line 107, in get_column_letter
    raise ValueError("Invalid column index {0}".format(col_idx))
ValueError: Invalid column index 0

And find this solution: sudo pip install openpyxl==1.8.6 Can be useful for other users of json2xlsx.

mkasa commented 8 years ago

It looks like json2xlsx works well with the current openpyxl. I've just tested json2xlsx with openpyxl-2.3.5 on MacOS X (El Capitan), and it worked fine.