Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C csvkit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 61
    • Issues 61
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • wireservice
  • csvkit
  • Issues
  • #958
Closed
Open
Issue created May 03, 2018 by Administrator@rootContributor

in2csv error message with provided XLS on Python 2

Created by: giovanma

I have an .xls file with two sheets and I wanted to create two .csv files (one per sheet). I type in2csv --write-sheets "-" test.xls in the command line and I obtain the following output:

/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 2 has no name. Using "c".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 3 has no name. Using "d".
/usr/local/lib/python2.7/site-packages/agate/utils.py:292: DuplicateColumnWarning: Column name "ESTIMATED PARAMS" already exists in Table. Column will be renamed to "ESTIMATED PARAMS_2".
**,ESTIMATED PARAMS,c,d,ESTIMATED PARAMS_2
,,,,
,,,,
,EPS_GAPOILTREND_RoW,,,EPS_GAPOILTREND_RoW
Traceback (most recent call last):
  File "/usr/local/bin/in2csv", line 11, in <module>
    load_entry_point('csvkit==1.0.3', 'console_scripts', 'in2csv')()
  File "/usr/local/lib/python2.7/site-packages/csvkit/utilities/in2csv.py", line 182, in launch_new_instance
    utility.run()
  File "/usr/local/lib/python2.7/site-packages/csvkit/cli.py", line 118, in run
    self.main()
  File "/usr/local/lib/python2.7/site-packages/csvkit/utilities/in2csv.py", line 165, in main
    tables = agate.Table.from_xls(self.input_file, sheet=sheets, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/agateexcel/table_xls.py", line 33, in from_xls
    book = xlrd.open_workbook(file_contents=path.read(), encoding_override=encoding_override)
  File "/usr/local/lib/python2.7/site-packages/xlrd/__init__.py", line 116, in open_workbook
    with open(filename, "rb") as f:
TypeError: coercing to Unicode: need string or buffer, NoneType found

coercing to Unicode: need string or buffer, NoneType found

If I transform the xls file into xlsx file and I type in2csv --write-sheets "-" test.xlsx

then everything works properly, and I obtain the following output:

/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 2 has no name. Using "c".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 3 has no name. Using "d".
/usr/local/lib/python2.7/site-packages/agate/utils.py:292: DuplicateColumnWarning: Column name "ESTIMATED PARAMS" already exists in Table. Column will be renamed to "ESTIMATED PARAMS_2".
**,ESTIMATED PARAMS,c,d,ESTIMATED PARAMS_2
,,,,
,,,,
,EPS_GAPOILTREND_RoW,,,EPS_GAPOILTREND_RoW
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 2 has no name. Using "c".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 3 has no name. Using "d".
/usr/local/lib/python2.7/site-packages/agate/utils.py:292: DuplicateColumnWarning: Column name "ESTIMATED PARAMS" already exists in Table. Column will be renamed to "ESTIMATED PARAMS_2".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 0 has no name. Using "a".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 1 has no name. Using "b".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 2 has no name. Using "c".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 3 has no name. Using "d".
/usr/local/lib/python2.7/site-packages/agate/utils.py:276: UnnamedColumnWarning: Column 4 has no name. Using "e". 

Since I am interested in .xls files I would like to know if it was possible to have the --write-sheets "-" option to work properly with .xls files.

I attach a zip file with both the xls and xlsx files I used.

Python 2.7.14 macOS 10.13.4 Thanks,

test.zip

Assignee
Assign to
Time tracking