There's a excel file with stream format.
from io import BytesIO
from openpyxl.workbook import Workbook
stream_file = BytesIO()
wb = Workbook(write_only=True)
ws = wb.create_sheet()
...
wb.save(stream_file)
stream_file.seek(0)
Update
I tried with one of answer above
print(os.fstat(stream_file.fileno()).st_size)
then got error
print(os.fstat(stream_file.fileno()).st_size)
io.UnsupportedOperation: fileno
And below trial successed
stream_file.seek(0, 2)
print(stream_file.tell())
stream_file.seek(0)
Is there other way to get the size of this stream file ?