I am new to python and odoo. I came across a scenario that i want to create a excel file first from my dynamic records and then want to save it to ir.attachment
table. So that i can link that as an attachment in email.
Here is what i tried, but its not writing into the file
workbook = xlsxwriter.Workbook('demo.xlsx')
worksheet = workbook.add_worksheet()
worksheet.set_column('A:A', 20)
bold = workbook.add_format({'bold': True})
worksheet.write('A1', 'Hello')
worksheet.write('A2', 'World', bold)
worksheet.write(2, 0, 123)
worksheet.write(3, 0, 123.456)
workbook.close()
Update
I am able to create the xlsx file, actullay it was my path issue. Now i just want to know that how to add that file in ir.attachment