Is it possible to write urls to .xlsx file via XLSXwriter as a plain text (without hyperlinks)? I mean, when I write urls, they are inserted as visible part and hyperlink. I would like to avoid hyperlink and leave url as a simple text string without any formatting
Here is my code:
b = xlsxwriter.Workbook(fn+'_'+time.strftime('%d.%m.%Y_%H-%M-%S')+'.xlsx')
s = b.add_worksheet()
s.set_zoom(125)
s.set_column('A:K', 30)
format = b.add_format({'align': 'left', 'font_name': 'Arial', 'font_size': 10})
s.write_row(0, 0, head, format)
for i in range(len(cols)):
s.write_column(1, i, cols[i], format)
b.close()
thanks,
You could use the write_string() method instead of write_column(). The write_column() method calls write() which calls write_url() by default. That would require you to roll your own loop.
Or set the workbook constructor property to tell the module to ignore urls when calling write():
workbook = xlsxwriter.Workbook(filename, {'strings_to_urls': False})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With