How do I send Tables with Telegram Bot API?

Aditya picture Aditya · Mar 18, 2018 · Viewed 17.3k times · Source

I need to send stock market data and the formatting sucks right now. Need to send something liike this

| Symbol | Price | Change | 
|--------|-------|--------|
| ABC | 20.85 | 1.626 | 
| DEF | 78.95 | 0.099 | 
| GHI | 23.45 | 0.192 | 
| JKL | 98.85 | 0.292 |

This is what I have tried.

| Symbol | Price | Change |  
|--------|-------|--------|  
| ABC | 20.85 | 1.626 |   
| DEF | 78.95 | 0.099 |   
| GHI | 23.45 | 0.192 |    
| JKL | 98.85 | 0.292 |

Answer

Ruslan Novikov picture Ruslan Novikov · May 21, 2019

Set the Telegram parse_mode parameter to HTML and wrap the text in <pre></pre>

<pre> | Tables | Are | Cool | |----------|:-------------:|------:| | col 1 is | left-aligned | $1600 | | col 2 is | centered | $12 | | col 3 is | right-aligned | $1 | </pre>

Result in Telegram messanger:

enter image description here

Updated There will be a problem on the small screens of smartphones. So this method is bad. The only option is to convert the tables in the picture and so send. :(