String variable in Xlsxwriter Python String variable in Xlsxwriter Python tkinter tkinter

String variable in Xlsxwriter Python


There may be other issues but this line isn't correct:

   workbook = xlsxwriter.Workbook(0, "2016" + str(name_get))

The Workbook constructor takes the parameters: Workbook(filename[, options])

So that line should probably be:

   workbook = xlsxwriter.Workbook("2016" + str(name_get))

Also, is it possible to create an extension of an excel file (.csv file, for example) in xlsxwriter?

No.

XlsxWriter only creates xlsx files and the file extension on the output file should be .xlsx or Excel will complain when it opens the file.


If I understand correctly you are trying to pass a string variable to the worksheet.write method.

This can be accomplished using the worksheet.write_string() method.

http://xlsxwriter.readthedocs.io/worksheet.html?highlight=write_string#write_string

ex. -

name_entry = ''worksheet.write_string(1,0, name_entry)