0

I keep getting the Detail AttributeError: 'module' object has no attribute 'workbook' error.

below is my code

import xlwt

workbook = xlwt.workbook()

sheet = workbook.add_sheet('Eswar')

sheet.write (4,4,'Test passed')

workbook.save("D:\resultsLatest.xls")

what have i done wrong?

I am using python 2.7

Nilesh
  • 20,521
  • 16
  • 92
  • 148
Brother85
  • 73
  • 3
  • 10

1 Answers1

3

In source code on github you can see right spelling Workbook. Your code should be:

import xlwt
workbook = xlwt.Workbook()
sheet = workbook.add_sheet('Eswar')
sheet.write(4,4,'Test passed')
workbook.save("D:\\resultsLatest.xls")
Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
Mikhail Kashkin
  • 1,521
  • 14
  • 29
  • Why isnt't this accepting the path I have given, it accepts only a file name when I save it using Workbook.save – Brother85 Aug 21 '14 at 17:06
  • Backslash is symbol with special meaning, I've updated example to fix this. It quote symbol next to it. More here http://stackoverflow.com/questions/301068/python-backslash-quoting-in-string-literals – Mikhail Kashkin Aug 21 '14 at 21:37