Reputation: 25
Saw several similar posts but they did not solve my issue. Really not sure why the write attribute isn't being recognized. Pip installed all appropriate components.Tried playing around with the parameters for write as well. Any help is appreciated.
import xlsxwriter
from xlsxwriter import Workbook
wb = Workbook('C:/Users/vlad.synnes/Desktop/workbook.xlsx')
wb.add_worksheet('Data')
wb.write('test')
wb.close()
send_file('C:/Users/vlad.synnes/Desktop/workbook.xlsx', as_attachment=True)
Upvotes: 2
Views: 15707
Reputation: 142631
You can write in worksheet
, but not in workbook
.
ws = wb.add_worksheet('Data')
ws.write(0, 0, 'test')
Full
import xlsxwriter
from xlsxwriter import Workbook
wb = Workbook('C:/Users/vlad.synnes/Desktop/workbook.xlsx')
ws = wb.add_worksheet('Data')
ws.write(0, 0, 'test')
wb.close()
You can see it even in documentation: https://xlsxwriter.readthedocs.io/workbook.html
Upvotes: 4