Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I'm trying to use OPENPYXL, I get this TYPE ERROR whenever i try to create an excel file

I am learning from Youtube, even if I copy the same code that runs on his screen I get the error.
Even if I copy other solutions from the internet I get the same error whenever the program wants to create an excel file.

from openpyxl import workbook

wb=workbook()
ws=wb.active
ws.title="Sheet-1"

ws['A1']="Simple data"

wb.save("too_bad.xlsx")

I have a gut feeling that this code is only faulty on my computer. I hope this gut is wrong

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Python modules are type-sensitive, so it makes a difference if you use "workbook" or "Workbook". The bellow code should work now.

from openpyxl import Workbook

wb=Workbook()
ws=wb.active
ws.title="Sheet-1"

ws['A1']="Simple data"

wb.save("too_bad.xlsx")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading