Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 232
kten Avatar asked Oct 20 '16 10:10

kten


1 Answers

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!

like image 194
Alex Zhang Avatar answered Oct 17 '22 05:10

Alex Zhang