Search code examples
pythonbotsslackslack-api

Is there a way to send rendered table via Slack API?


I'm trying to send SQL query results via Python Slack bot it should look like a three-column table

Things I tried:

  • Send a raw HTML table to be rendered as a table in Slack.
  • Send a Markdown table to be rendered in Slack.
  • Send an ASCII art table to be displayed in Slack.

None of the above worked, the ASCII one did not align properly and the others did not render at all

I read in the official API docs that there is a way to make a two-column table using section, but I need three or more columns.

Is there any way to send via Python + SlackAPI a nice looking table?


Solution

  • As @OneCricketeer said, Slack does not support tables.

    You can find alternative ways to display a table here. If you decide to transform a table into an image, you can start here.