df = pandas.DataFrame()
bb = BytesIO()
bb.name = f'test.xlsx'
bb.encoding = "utf-8"
to_add = {'1': one,
'2': one,
'3': one,
'4': one,
'5': one,
'6': one,
'7': one}
df = df.append(to_add, ignore_index=True)
df.to_excel(bb, index=False)
bb.seek(0)
await bot.send_document(message.chat.id, bb)
await bot.send_document(chat_id=message.chat.id, document=bb)
import pandas
from io import BytesIO
one = 'ttt'
to_add = {'1': one,
'2': one,
'3': one,
'4': one,
'5': one,
'6': one,
'7': one}
bb = BytesIO()
bb.name = f'test.xlsx'
bb.encoding = "utf-8"
df = pandas.DataFrame()
df = df.append(to_add, ignore_index=True)
print(df)
df.to_excel(bb, index=False)
with open(bb.name, 'wb') as f:
f.write(bb.getbuffer())