Tuesday, November 21, 2023
HomeProgrammingHow to convert between HTML and Excel?

How to convert between HTML and Excel?

There are many situations where you want to convert HTML and Excel, such as converting HTML content to Excel or vice versa.
There are several methods, and I would like to introduce each feature in this article.

The browser is “Google Chrome” and Excel is “2019” or later.

Table of contents

  • Convert HTML to Excel
    • 1. Read the file in Excel
    • 2. Copy directly from the browser screen
  • Convert Excel to HTML
  • summary

Convert HTML to Excel

First, let’s load an HTML file containing a table into Excel.
As an example, prepare the following HTML file. Leave the file name as “list.html”.

<!DOCTYPE html>
<html lang="ja">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
            border-collapse: collapse;
        tr {
            border: 1px solid #bbb;
        th, td {
            border-right: 1px solid #bbb;
            padding-left: 1em;
            padding-right: 1em;
        th {
            background-color: #E2EFDA;
        td:not(:first-child) {
            text-align: right;

Let’s convert this to Excel.

1. Read the file in Excel

When you open Excel, select “Open”, and specify the location, the HTML file is displayed normally.

Select the file and press “Open” to display the contents of the HTML file in Excel.

It is also possible to name and save as an Excel file as it is.
However, although you can get the width of the data and table, the color setting of the header part is gone.

2. Copy directly from the browser screen

If you want to use only the table part of the HTML or want to keep the color settings as much as possible, there is a method of copying from the browser screen as it is.
Select the part you want to copy and select Copy.

If you paste this into Excel, it will be pasted while maintaining the style to some extent.

The cell size and text size may collapse, so adjustment is necessary, but you can leave the color settings.

Convert Excel to HTML

This time it is a method to convert the contents of Excel to HTML.
As an example, let’s output the following table as HTML.

Select “File” in the upper left.

A menu will appear, select “Save As” and select a save location.
At this time, the document type is “Excel book ( .xlsx)”, so change it to “Web page ( .htm, *.html)”.

When saved, it will be output in HTML as follows.

The actual table data is described in the HTML in [output file name].files.

If you actually open this file, you’ll see the following code:

Image of the code actually written in the file

You can get the HTML tags by copying them as they are, but since they are automatically generated files, the styles are written directly each time, and information corresponding to phonetic syllabaries is written.
Be careful if you want to post the Excel table as it is on your website.


I introduced how to convert between HTML and Excel.

  • Basically, it is possible to read and write HTML with the function of Excel
  • If you want to keep the style information of the table from HTML to Excel, it is better to copy and paste from the browser
  • Note that Excel → HTML converts unnecessary information such as phonetic syllabary at the same time

Conversion between Excel and HTML is often done, but please understand the characteristics and choose the most suitable method.


Leave a reply

Please enter your comment!
Please enter your name here

Recent Posts

Popular Posts

Most Popular

Recent Comments