lalalala
lalalala

Reputation: 563

how to put encoding on xlsxwriter with python

I want to write to excel files from textfiles and have centimeter square string in it like this picture

enter image description here

and when i run the the code it shows error like this

enter image description here

So i put an encoding but still not working like this

spamReader = csv.reader(open(filename, 'rb'), delimiter=';',quotechar='"')
workbook = xlsxwriter.Workbook(filename[:-4] + '.xlsx')
workbook.encoding="latin1"
sheet = workbook.add_worksheet('Original data')

Thanks for advance

Upvotes: 1

Views: 3933

Answers (1)

lalalala
lalalala

Reputation: 563

sheet.write(rowx, colx, value.decode('latin1'))

Upvotes: 4

Related Questions