✍ Create a table using markdown

Table generator

Creating tables via markdown takes some practice. That’s why the easiest way if you are a beginner is to use this online tool:

Markdown Tables generator - TablesGenerator.com

You can choose how many rows/columns the table should have, alignment, other options and then simply fill in the data → click Generate → copy the generated markdown to your post.
If you have a Spreadsheet or a *.CSV file you can simply click File in the top → Import CSV file or Paste table data:
image

Create a table in your post via markdown manually

For this howto, we will use a table with three columns. You can create a table with as many columns as you want but keep in mind that the width of your post is limited, and a large table can be pretty ugly on mobile.

The base of a table is really simple, each | character will represent one column. Between two | you can add the content that you want. You need to start and finish each line of your table with the character |

First, you need to create a header for your table. You will need two rows to do that:

  • the first one will define the title of each column.
  • the second one will create the separation with the rest of your table (and alignment, but we will see about that later)

Let’s begin :

| Col A | Col B | Col C |
|---|---|---|

Here is our base, three columns, and a title on each. The result of this code is this:
Col A Col B Col C

We now have our header, let’s create a row in our table, this is simple, it works exactly as the rest. Start and finish with | and keep track of the number of columns that you used :

| Col A | Col B | Col C|
|---|---|---|
| A1 | B1 | C1 |
Col A Col B Col C
A1 B1 C1

Do you know that emojis or markdown works in the table ? You can bold some text and add an emoji as you wish.

Let’s make our example better, I’ll add a new row with an emoji in one cell :

| Col A | Col B | Col C|
|---|---|---|
| A1 | B1 | C1 |
| A2 | B2 | :smile: |
Col A Col B Col C
A1 B1 C1
A2 B2 :smile:

You can leave an empty cell too if you want. You need to create the columns with | as always, just leave it empty. In our example, I’ll leave the B2 cell empty :

| Col A | Col B | Col C|
|---|---|---|
| A1 | B1 | C1 |
| A2 |  | :smile: |

The result :

Col A Col B Col C
A1 B1 C1
A2 :smile:

Alignment

Like I said before, the row between the head and the rest of your table can generate the alignment of your column. In our first examples, the row looks like this: |---|---|---| .

On each column, the character : can indicate the alignment of your column. If you put a colon : on the left of the dashes, the alignment of the entire column will be on the left. If you put on the right of the dashes, the alignment will be on the right. If you put : on each sides, your column will be centered :

| Left | Center | Right |
|:---|:---:|---:|
| My content is on the left | I'm the center of the world | I like being on the right side |
| :waxing_gibbous_moon: | :full_moon: | :waning_gibbous_moon:|
Left Center Right
My content is on the left I’m the center of the world I like being on the right side
:waxing_gibbous_moon: :full_moon: :waning_gibbous_moon:

You know pretty much all there is to know about the tables on the Software AG Tech Forums.

2 Likes