67

Is there a web app that can create ASCII-art tables like this one?:

------------------------------------------------
|           | ColA            | ColB           |
------------------------------------------------
| Row1      | CellA1          | CellB1         |
------------------------------------------------
| Row2      | CellA2          | CellB2         |
------------------------------------------------
| Row3      | CellA3          | CellB3         |
------------------------------------------------

It doesn't have to use ASCII (it can be Unicode), I meant ASCII in the sense of ASCII art.

This would be useful for sites that don't support proper tables (like Stack Exchange).

80

Now there is: Format Text as Table.

I've been meaning to create this utility for a while. I was actually inspired by MySQL's command line utility and the lack of tables on SO. So thanks for reminding me to make it.

And thanks to @Lipis for the Unicode char idea.

Here's an example of the output:

+------+--------+--------+
|      | ColA   | ColB   |
+------+--------+--------+
| Row1 | CellA1 | CellB1 |
| Row2 | CellA2 | CellB2 |
| Row3 | CellA3 | CellB3 |
+------+--------+--------+
  • 2
    I don't always want to fire up Excel to put in a table. Would you consider allowing other delimiters (comma, 2+ spaces, semicolon...) to be used in your utility? – Kevin Vermeer May 9 '11 at 22:19
  • 1
    this is excellent! referenced at meta.stackexchange.com/questions/96125/… – Jeff Atwood Jun 23 '11 at 9:08
  • @KevinVermeer: I made it so that you can type the tab character in the edit box. Does that solve the problem, or do you still want other delimiters? – Senseful Dec 22 '11 at 2:00
  • I really like this tool, but it has problems dealing with blank/empty cells from excel – Forward Ed May 7 '16 at 23:51
  • 2
    @EdwardFalk: I just fixed it and updated the link! – Senseful Aug 28 '16 at 6:29
21

The following utility (created by me) may come in handy for such scenarios : http://plaintexttools.github.io/plain-text-table/

screenshot

Usage is fairly simple and intuitive, thanks to the spreadsheet like editing capabilities of handsontable . Also it handles multi-line cells neatly.

  • Looks very nice. I would add a screenshot to make it stand out more !! – Jacob Jan Tuinstra Jan 18 '14 at 14:43
  • @JacobJanTuinstra Thanks for the feedback. Updated the answer as per your suggestions. – lorefnon Jan 18 '14 at 15:32
  • This one is superb. I'll be bookmarking this one. – Edward Falk Jun 29 '16 at 2:11
8

While not especially for tables, Asciiflow is a generic tool for this kind of thing.

3

Since the OP specifically says:

It doesn't have to use ASCII (it can be Unicode)

I thought I'd share the link for the (mysql / unicode / html) table generator created by a SE user for use on SE I found on superuser. I found it quite useful to get unicode tables (which I sometimes prefer over the Windows-1252 compatible "ASCII" art). And this tool lets you compare the outputs, as well as getting a HTML formatted table, too.

Example to show my workflow:
I'm making a web app for my bookkeeper to calculate sales tax and I am doing math on months and quarters so that the tool always automatically displays "last quarter's sales tax info". Since I'm always thinking of arrays starting with 0, I needed to embed a simple table outlining the months in each quarter to keep the values sorted in my head.

1) To get the table started, I used this generator (listed on both this and the other QA) with its Excel-like input interface to actually create the data, as the unicode tool wants pre-formatted text. I type in the values then select them and CTRL-C to get my tab delimited table:

Quarter Numbers Names
Q1  1, 2, 3 Jan, Feb, Mar
Q2  4, 5, 6 Apr, May, Jun
Q3  7, 8, 9 Jul, Aug, Sep
Q4  10, 11, 12  Oct, Nov, Dec

2) went to senseful's generator and pasted into the input area. I played with each of the 3 options and I liked the Unicode Art option the best:

╔═════════╦════════════╦═══════════════╗
║ Quarter ║  Numbers   ║     Names     ║
╠═════════╬════════════╬═══════════════╣
║ Q1      ║ 1, 2, 3    ║ Jan, Feb, Mar ║
║ Q2      ║ 4, 5, 6    ║ Apr, May, Jun ║
║ Q3      ║ 7, 8, 9    ║ Jul, Aug, Sep ║
║ Q4      ║ 10, 11, 12 ║ Oct, Nov, Dec ║
╚═════════╩════════════╩═══════════════╝

Note that for the table to show up correctly on a web page, the character set must be specifically set for UTF-8:

<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

  • You know that the accepted answer is the tool you suggest and it is posted by the author you mention, right ? :) – Gabriele Petrioli Apr 6 '14 at 10:07
  • yes... between this and another answer, I wanted to show my workflow, since either by themselves didn't help my situation and would have required transcribing the whole table. Together, I didn't need to type all that info in by hand. – Chris K Apr 10 '14 at 20:28
  • I have updated lorefnon.me/plain-text-table You can now directly generate the desired Unicode Art output (see the style option Double Border) – Jmini Apr 8 '15 at 20:52
0

You can also use this tool for mysql tables: MySQL Table to text

Not the answer you're looking for? Browse other questions tagged or ask your own question.