from io import BytesIO
from openpyxl import Workbook

wb = Workbook()
virtual_workbook = BytesIO()
wb.save(virtual_workbook)

# now use virtual_workbook to send to a stream; email attachment, etc