How to get reasonably formated text tables out of excel for use as plain text or Markdown

excel, format, text

Solution

If I have a table like this:

I would do it with the following steps:

Add the header separators from a new row using a bunch of `-`, making sure that there is more than than less:

Insert additional columns to contain the column separators, then select the cells that will have the separators. Insert the separator and then, instead of pressing Enter, I would press Ctrl+Enter to fill all the selected cells at the same time:

Format everything to the font Courier New, adjust the alignments and column widths:

Save as Formatted Text:

This will look like this if you open the file in notepad:

Problem

I had the following situation: Spreadsheet used to calculate pricing for a bunch of different kinds of trees. (I'm a tree farmer) This data has two uses: - I use it in Markdown to make tables on my web page. - I use it in kijiji ads. The latter made things sticky. Cut and paste from excel leaves data separated by single tabs. Nothing lines up. A pasted table in excel in some program like Kijiji looks like this: ``` | Bareroot Bundles of 25 2-3 year olds |||| | Bundles | # Trees | Cost | Price Per Tree | |: ------------- :|: ------- :|: ------- :|: ------------------- :| | 5 Trees | 5 | $30.00 | $6.00 | | Single Bundle | 25 | $75.00 | $3.00 | | 5 Bundles | 125 | $300.00 | $2.40 | | 10 Bundles | 250 | $525.00 | $2.10 | ``` Yuck.

Original source