yeswecode
yeswecode

Reputation: 303

Can't create .xlsx file

I'm trying to create '.xlxs' file via xlsxwriter but it doesn't create. After entering the command, nothing happens.

import xlsxwriter
workbook = xlsxwriter.Workbook('file.xlsx')

Upvotes: 0

Views: 1153

Answers (2)

James
James

Reputation: 457

For completeness' sake, a short, but complete demo is shown in the docs: http://xlsxwriter.readthedocs.org/example_demo.html#ex-demo

As Jkdc mentioned, you need to add a worksheet and close it in addition to "creating" it.

Upvotes: 2

MrAlexBailey
MrAlexBailey

Reputation: 5289

You need to add a worksheet:

worksheet = workbook.add_worksheet()

and then close the workbook:

workbook.close()

Upvotes: 4

Related Questions