Copy a table from Excel or Google Sheets and paste it into the text box below to create a Markdown table. This online tool is made possible by Jonathan Hoyt’s innovative copy-excel-paste-markdown code. I’ve also modified his code to create a version that supports column alignments as explained below. Here are the steps:
- In Excel or Google Sheets, select a range of cells and press Ctrl+C to copy.
- Paste (Ctrl+V) into the text box below to create a Markdown table.
Additional Notes
- If your table is wide, the resulting text in the text box will appear to be wrapped and misaligned; however, everything will align properly when you copy it from the text box and paste it into your Markdown editor/text editor.
- I have written an article on using Markdown with Visual Studio Code if you are looking for a good Markdown editor.
Column Alignments
You can optionally specify column alignment information by prepending one of the following to the column heading names in Excel:
- ^c – center alignment
- ^r – right alignment
- ^l – left alignment (the default)
For example: enter the following in Excel to right-align the second column and center-align the third column:
animal | ^rweight | ^ccolor |
---|---|---|
dog | 30lb | tan |
dog | 85lb | black |
cat | 18lb | calico |
This will produce the following markdown table when pasted:
| animal | weight | color |
|--------|-------:|:------:|
| dog | 30lb | tan |
| dog | 85lb | black |
| cat | 18lb | calico |
Enjoy!
Additional articles
Build an Amazing Markdown Editor Using Visual Studio Code and Pandoc
Guide to Installing Node.js on a Raspberry Pi
Debian apt Command Cheat Sheet
Consuming JSON Web Data Using Google Sheets
Follow @thisDaveJ (Dave Johnson) on Twitter to stay up to date with the latest tutorials and tech articles.
Thanks Dave. This is so useful!
If this didn’t exist, I was going to consider making it. Well done, Dave!
Hi,
this seems very useful tool. THX! However, am I right assuming that you have a certain limit on number of rows and columns? I have 20×12 table, but when I try to paste nothing happens. Or are there other reasons why pasting the clipboard isnät possible?
Thanks in advance, renzo
Renzo, make sure your last field in the selection has some content, the trimming of data that is performed in this script, removes the last cell if it’s empty.
fffref
Thanks for this m8!
awesome! thanks a bunch!
Is there a limit on the number of columns.
I’m not aware of any specific limit, but I’m sure there’s a practical limit somewhere. Let me know if you find it!
Awesome, man! Thank you a lot!
FYI – it seems there is a bug that doesn’t handle blank columns
Thanks for the tool, very handy!
Beej, that’s an interesting edge case – thanks for sharing. I tested and see that the tool can handle blank columns if they are in the middle of the table. It will ignore blank columns if they are the outermost left or right columns. As a workaround, if you wish to include a blank outermost left column, for example, temporarily include a single character such as “x” in any cell in the left column in Excel/Sheets before pasting it into the textbox on this web page. You can then remove the “x” in the resulting markdown syntax and you will have achieved a blank left column.
I did a fork on it and. Then I did small changes like translation and some front end:
https://cuelholima.github.io/copiar-excel-colar-md/
Thanks,man. I like https://tableconvert.com/
Nice tool.
Awesome, thanks so much!!
Thanks so much, Dave!!!!!!!!!!!!!! I will send this tool to my students @ UTFPR.edu.br
Awesome – thanks for sharing with your students!!
Thank you very much!
Thank you for this great tool, but it doesn’t work with me, why? I’m using google spreadsheets on firefox, and I copyed and paste and nothing happens.
Thanks! Would be nice if bold/ italic formatting was handled as well
Saved me a good deal of time. Cheers 🙂
Please support links and bold and italic markdown formatting.
That would be a cool feature. Unfortunately, the information copied to the clipboard from Excel/Sheets does not contain formatting such as bold/italic or embedded URLs from links. Everything is copied as plain text. Bold/italics/links can be accomplished using Markdown syntax in Excel/Sheets before copying over. For example, enter “**bold text**” in an Excel cell before copying the cells over and pasting into the text box.
What kind of black magic is this? Awesome!
I also works when copying from SQL Server Management Studio (SSMS) results, including “Copy with Headers”.
Oren, thanks for sharing! The code works with anything pasted from the clipboard that utilizes a TSV (tab-separated value) format so it’s good to know that SSMS results are included in that category too.
Thanks a lot. This is so awesome!!!
Hi Dave –
First, this has been a massively useful tool – I don’t understand why this function isn’t native to Excel.
Is it possible to get the table header row formatted with ||’s somehow, such as:
|| Name || Title || Email Address ||
|————–|——-|—————-|
| Jane Atler | CEO | [email protected] |
| John Doherty | CTO | [email protected] |
| Sally Smith | CFO | [email protected] |
I don’t quite understand what you are trying to achieve with the double pipe characters. Feel free to expand on your use case/end objective. In markdown, you can escape pipe characters using “\|”, to ensure they appear, for example, when the markdown is rendered as HTML. By adding “\|” (without the quotes) at the desired locations in Excel or Google Sheets, the tool on this page will ensure they appear when pasted into the textbox.
This is awesome stuff. How to ensure text wrapping does not happen and column width is maitnained
Love this tool, thank you very much!
Good job, its simple and useful
Many, many thanks … I had a pit in my stomach when the boss said “Oh, just stick that on the wiki page” … but thankfully the first hit on the search was your page, and it worked a treat.
I’ve mega-impressed with this
Steve – thanks for the positive feedback. Jonathan Hoyt deserves most of the credit here since he created the original version and I’m doing my small part by adding a couple features and hosting it. Glad it’s adding value for you!
Nothing happens when i try to pase in my excel table
Anyone know of rest-api website that takes csv/tsv as input (likely as json rather than copy/paste) and provides md/rst as output? Seems it could just use algorithm in https://github.com/jonmagic/copy-excel-paste-markdown/blob/master/script.js
OMG this is awesome, thx a lot!
Greetings from the city of San Diego, and thank you for your positive contribution to developer tools on the web!
Literally saved my sanity. Thanks Dave!