import * as TelegramBot from 'node-telegram-bot-api';
import * as fs from 'fs';
const TOKEN = '<your_token_got_from_gotfather>';
const GROUP_ID = '<your_group_id>';
const FILE = './data.xlsx';
const bot = new TelegramBot(TOKEN);
bot.sendDocument(
GROUP_ID,
fs.readFileSync(FILE),
{
caption: 'Daily Report'
},
{
filename: 'data.xlsx',
contentType: 'application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
.then(() => {
console.log('File has been sent');
});
Created
July 13, 2018 06:46
-
-
Save umidjons/0734272c87239f54f594655267baf4fe to your computer and use it in GitHub Desktop.
Send an Excel file into Telegram group using node-telegram-bot-api
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can't send file with this code.

When I sent code, the excel doesn't open.
What's wrong with me ?