I am writing a set of records in excel but I am not supposed to create a physical file. How do I write the records in excel in memory? If I do write it, how do I see the output of the records? I have tried:
import xlsxwriter
import io
filename= io.BytesIO()
workbook=xlsxwriter.Workbook(filename,{'in_memory': True})
worksheet=workbook.add_worksheet('sheet1')
worksheet.write(1,1,'Testing')
print(workbook.get_worksheet_by_name('sheet1'))
workbook.close()
filename
should be a string (and from the documentation it doesn't sound like you need to be usingio.BytesIO
anyway). – Teishateixeira'in_memory'
prevents it from creating any temp files, but ultimately it needs the name of file that it can open (by name) and write data into. – Teishateixeira