Not able to write a string to libre calc using xlwt

50 views Asked by At

I need to send my Raspberry Pi's MAC address to the excel sheet using xlwt module in python.

I am already pushing the date and time and a barcode generated dynamically. Which is working fine.

But everytime I try to send the MAC address, it doesn't happen. It just shows a blank cell.

Here is my code

MAC = open("/sys/class/net/eth0/address').read()
workbook.write(0, 0, barcode)
workbook.write(0, 1, time)
workbook.write(0, 2, MAC)

Now, the barcode and time are written in the cells perfectly. But the MAC just won't write. What may be the problem?

1

There are 1 answers

0
John Machin On

add the following line to your code:

print(ascii(MAC))

and edit your question to show the result. Also it would be very good if you showed the workbook being created and saved.