xlsxwriter.Workbook AttributeError: 'module' object has no attribute 'Workbook'

python, xlsxwriter

Solution

Make sure your file isn't named `xlsxwriter.py`.

If it is, which was why I got the same error, all `import xlsxwriter` will do is import the current file, and not the xlsxwriter module installed in your python environment.

Hope this helps!

Problem

Saw this article Detail AttributeError: 'module' object has no attribute 'workbook' for the same and the error there was a typo."W" is uppercase for Workbook. Also the package used is xlwt. I use Python 2.7 in unix. Installed XlsxWriter and used as below(Same example as given in the official page http://xlsxwriter.readthedocs.io/getting_started.html) xlsx version is 0.9.3 ``` import xlsxwriter workbook = xlsxwriter.Workbook('hello.xlsx') worksheet = workbook.add_worksheet() worksheet.write('A1', 'Hello world') workbook.close() ``` I use XlsxWriter version 0.9.2. Please help me figure out what else could be wrong here . Now i am able to get the excel output using xlwt package.

Original source