Skip to the content

Contact usFree tools · No signup · Files stay on your device

Developer Tools

Excel to HTML Table: the complete guide to putting spreadsheet data on a web page

Excel to HTML Table: the complete guide to putting spreadsheet data on a web page

A price list, a result sheet or a timetable often starts in Excel and ends up on a web page. Rebuilding it by hand is slow and the usual shortcut, copying cells straight into an editor, can bring a pile of stray formatting with it. Our free Excel to HTML Table tool reads an .xlsx or .csv file, or cells you paste from Excel or Google Sheets, and gives you clean table code you can copy.

This guide covers every option, the three styling modes, how numbers are aligned, and the problems to expect. If you want a Markdown table instead, see how to make a Markdown table from Excel or Google Sheets.

What Excel to HTML Table does

It turns rows and columns into a <table> with a <thead> for the header row and a <tbody> for the rest. You see the code, a live preview, and the size of the result. It can also switch the same data to a Markdown table.

It reads the text each cell displays, so a date shows as Excel shows it and a formula shows its last calculated result. It does not carry over fonts, colours, column widths, merged-cell layout or hyperlinks. The table is data plus the styling you choose here.

How to use Excel to HTML Table, step by step

  1. Open Excel to HTML Table.
  2. Press "Choose an Excel or CSV file", or paste into the box labelled "Or paste cells copied from Excel or Google Sheets, or CSV text". Press Sample to try it first.
  3. If the workbook has several sheets, pick one in Sheet.
  4. Set the options in the Table options panel.
  5. Check the Live preview.
  6. Under Code, make sure Output format says "HTML table", then press "Copy HTML" or "Download .html".

The code updates as soon as you change an option.

Every option explained

Styling

This choice matters most, because it decides how much CSS goes into the code.

Inline styles (works anywhere) writes borders, padding and alignment into every tag. The table looks right in an email, a CMS or a page with no stylesheet:

<table style="border-collapse:collapse;width:100%">
  <thead>
    <tr>
      <th scope="col" style="border:1px solid #d0d5dd;padding:8px 12px;text-align:left;background-color:#f2f4f7">Item</th>
      <th scope="col" style="border:1px solid #d0d5dd;padding:8px 12px;text-align:right;background-color:#f2f4f7">Qty</th>

Classes only (your CSS) writes no styles. Number cells get the class num, and you can name the table's own class in the Table class box (the default is table):

<table class="table table-striped">
  <thead>
    <tr>
      <th scope="col">Item</th>
      <th scope="col" class="num">Qty</th>

The Table class box only appears in this mode. It accepts letters, digits, hyphens, underscores and spaces, so table table-striped works. Anything else is removed.

Plain, no styling writes bare markup: no style or class attributes at all, whatever else is ticked. "Right-align numbers" then only affects the Markdown table.

Caption (optional)

Text for the table's <caption>, up to 200 characters. A caption names the table for people using screen readers and gives search engines context. Leave it empty for no caption. In inline mode the caption is left-aligned and semi-bold.

Rows to include

All rows, or the first 10, 25, 50, 100, 500, 1,000 or 5,000 body rows. The header row is not counted. A note says "N more rows left out by “Rows to include”" when rows were cut. Use this for a sample or a "top 10" table.

Indent (HTML)

2 spaces, 4 spaces or Tabs. It changes only the layout of the code, not the table.

First row is the header

Ticked by default. The first row goes in <thead> as <th scope="col"> cells. Untick it if the sheet has no header; then every row is body, and the table has no <thead>.

Right-align numbers

Ticked by default. A column is right-aligned, header included, when at least 80% of its filled body cells look like numbers. That covers thousands separators, currency signs, percentages and brackets for negatives. Text, dates and values such as 007 or 01712345678 stay left. In an Excel file, any cell that Excel stores as a number counts, so a column of ID codes stored as numbers will be right-aligned. Untick the option if that looks wrong.

Skip empty rows

Ticked by default. Rows with no text anywhere are dropped.

What it accepts and its limits

  • Files: .xlsx, .xlsm, .xltx, .xltm, and .csv, .tsv or .txt text. Up to 100 MB.
  • Old .xls files: refused with a message asking you to save them as .xlsx first.
  • Pasted text: tab-separated cells copied from Excel or Google Sheets, or comma, semicolon or pipe separated text. The separator is detected automatically. A cell with a line break inside it is kept, and the break becomes <br>.
  • Preview: the first 200 rows. The code has them all.
  • Code box: shows the first 200,000 characters of a very large result. Copy and Download give everything.
  • Paste box: it only appears when no file is loaded. Press Change file to go back to it.
  • Merged cells: the value stays in the top-left cell and the others are empty, which is how Excel stores them.

Privacy

Excel to HTML Table runs in your browser. The file or pasted text is converted on your device and is never uploaded.

The output is safe to publish as far as the data goes. Every cell is escaped, so <, >, & and quotes in your data appear as text and cannot inject tags or scripts. The live preview is built from plain table cells, not by injecting the HTML.

A worked example

Copy these cells from a sheet (they arrive tab-separated):

Product	Qty	Price	In stock
Notebook A5	120	$4.50	yes
Gel pen, blue	1,500	$1.25	yes
Desk lamp	8	$39.00	no
Sticky notes <3	300	$2.10	yes

Paste them. The tool right-aligns Qty and Price, and the last row's text is written as Sticky notes &lt;3, so it shows as a literal "<3" on the page. The stat line reads 4 rows and 4 columns. Choose "Classes only", type Stock list as the Caption, and the code starts:

<table class="table">
  <caption>Stock list</caption>
  <thead>

That is the Sample button's data, so you can try it yourself.

Where to paste the code

  • A CMS or blog editor: use a "Custom HTML" or "Code" block, not the visual editor, which may rewrite the markup. With Inline styles the borders survive most editors.
  • An email: Inline styles is the safest mode, because many email programs ignore style sheets.
  • Your own site: use Classes only and style table, th, td and .num in your CSS. Keep right alignment in .num { text-align: right; }.
  • A full page: press "Download .html" to get a complete document with <!doctype html>, lang="en", a title taken from the file name, and a viewport tag.

Wide tables can overflow a phone screen. Wrap the table in a <div style="overflow-x:auto"> yourself if your page has many columns.

Tips to work faster

  • Clean the sheet first: delete helper columns and notes under the data. The tool converts everything on the sheet.
  • Use a short header row. Long headers make narrow screens harder to read.
  • Set a Caption. It costs nothing and helps accessibility.
  • If the numbers are stored as text with spaces or symbols, check the right-alignment in the preview before copying.
  • For data headed into code rather than a page, Excel to JSON is the better fit.

Common problems and how to fix them

Dates look different from Excel

The tool shows the text Excel displays, so check the cell's number format in Excel. If it shows 46082, the cell was formatted as a number, not a date.

A number column is on the left

Fewer than 80% of its filled cells looked like numbers. A single unit such as 12 kg or a stray note in the column can cause this.

The table has no header

"First row is the header" is unticked. Tick it and the first row moves into <thead>.

The code is huge

Inline styles repeat the same CSS in every cell. Switch to Classes only, or limit the rows with Rows to include.

They are not carried over, because the table is built from cell text. Add links in your CMS after pasting.

Quick checklist

  • Choose Inline styles for email and CMS, Classes only for your own site.
  • Add a Caption.
  • Check which columns were right-aligned.
  • Use Rows to include for a long sheet.
  • Paste into a code or HTML block, not the visual editor.

Frequently asked questions

Which Styling option should I choose?
Choose Inline styles when the table will be pasted into an email, a CMS or any page you do not control, because the borders and padding travel with each tag. Choose Classes only when your own stylesheet will style it, and Plain, no styling for bare markup.
Why are some columns right-aligned and others not?
A column is right-aligned when at least 80% of its filled body cells are numbers. Text, dates and values with leading zeros, such as phone numbers, stay on the left. Untick Right-align numbers to turn this off.
Does it keep bold text, colours or links from my sheet?
No. The table is built from the text each cell shows, so cell formatting and hyperlinks are not carried over. Style the table with the Styling option or with your own CSS.
Can I put only the first rows of a long sheet on the page?
Yes. Rows to include offers All rows or the first 10, 25, 50, 100, 500, 1,000 or 5,000 body rows. A note tells you how many rows were left out.
What does Download .html give me?
A complete web page: doctype, a head with title and viewport, and your table in the body. Use Copy HTML instead when you only want the table to paste into an existing page.
Found this useful? Share it

Tools in this guide

Main tool

Excel to HTML Table

Get clean table code from a spreadsheet: open an .xlsx or .csv file or paste copied cells, choose your styling, and copy the HTML or a Markdown table.

Open tool

Excel to JSON

Turn a spreadsheet into JSON you can use in code: an array of objects keyed by your header row, or plain arrays.

Open tool

CSV to Excel

Turn CSV files into a proper Excel workbook: numbers you can add up, leading zeros kept, a bold header row with filter buttons that stays visible.

Open tool

Markdown Previewer

Write Markdown and see it rendered instantly, with GitHub-style tables, task lists and code blocks.

Open tool

Back to all guides & blog