Paste TSV copied from Excel or Google Sheets as a Markdown table, and copy a Markdown table as TSV to paste back into a spreadsheet.
Commands
Command
Action
Markdown Table TSV: Paste TSV as Markdown Table
Converts the TSV in the clipboard to a Markdown table and pastes it at the cursor (replacing the selection; at every cursor with multiple cursors)
Markdown Table TSV: Copy Selected Markdown Table as TSV
Copies the table rows on the selected lines as TSV. Without a selection, does the same as Copy Whole Markdown Table as TSV
Markdown Table TSV: Copy Whole Markdown Table as TSV
Selects the table at the cursor (or the first table below the cursor) and copies it as TSV
Markdown Table TSV: Select Next Markdown Table
Selects the table at the cursor (or the first table below the cursor). Run it again to select the next table
Command names and messages are shown in English or Japanese according to the VS Code display language. No keys are assigned by default. Assign them in Keyboard Shortcuts if you like.
TSV to Markdown
The first row becomes the header.
Columns are aligned by display width, counting full-width characters (CJK) and emoji as 2.
Columns that are empty in every row are removed. Leading and trailing whitespace in cells is removed.
Quoted cells (as Excel copies cells containing line breaks) are supported. Line breaks in cells become <br>, and | becomes \|.
Lines that start and end with | (ignoring surrounding whitespace) are treated as table rows. The separator row (| --- | :-: |) is skipped.
\| is restored to |, and <br> to a line break. Cells containing line breaks or tabs, and cells starting with ", are quoted so that spreadsheets read them as one cell.
Limitations
Tables without leading and trailing | are not recognized.
Characters whose width depends on the font (East Asian Ambiguous, such as ○ or ※) are counted as 1.