I present Excel2html, an add in for Excel that allows you to convert a Excel sheet into an HTML table, while preserving formulas. This allows us to easily include in your blog or web pages, small spreadsheets. For example, mortgage calculators, CO2 emissions calculators…

Here you have an example of a table converted from a Excel sheet. You can modify the input values ​​in the table and see how the final column is calculated. However, the constant variables can not be modified (I will explain later how to define constants cells). Also, as you see, the addin has the option to copy background, borders, fonts…

Valor AValor BValor C(A+B)·C

Installation instructions

The program installs as any other Excel addin. The steps to install the easiest way are the following:

  • Download this file: Excel2html v1.2
  • Click on the downloaded file with the right mouse button and select ‘copy’.

Now let’s copy the addin in Excel plugin folder:

  1. Open an Excel spreadsheet, click on the main menu, and select ‘Options’.
  2. Select the tab ‘Complements’ and click ‘Go’.
  3. Select ‘Browse’, right click and select ‘paste’ (doing this you have copied the addin in the Excel plugin folder). Finally, select the file you just copied.
  4. Excel2html will be available in the Ribbon, in the ‘Complements” tab.

The following pictures show the process. (click images to enlarge).

User manual

Using the program is very easy, you just need to click two buttons. The step by step instructions are as follows:

  1. Select the cells you want to convert.
  2. Starts Excel2Html addin, select the options you want.
  3. Press ‘Make’. The program converts the cells in HTML. The process can take a few seconds, if the selection is large. Please, be patient.
  4. The code appears in the program. Click ‘Copy’ button to copy the text to the clipboard.
  5. Press ‘Exit’ button to close the program.
  6. Go to your HTML editing program and paste the generated code. The html code generated has two parts.
    • The Javascript part (between script and /script tags) has to be inserted into the page header (between head /head tags).
    • The form part (between form and /form tag) must be inserted in the body of the page (between body and /body tags)

Note: If you insert the table into your own page you should have no problem. Neither should have no problem in Blogger, simply paste the code in the post. But WordPress doesn’t let to insert Javascript on post, so you need to use a plugin (e.g. “Insert JavaScript & CSS”) that allows you to insert the script in the header. Other systems (Joomla, Drupal …) may also need additional plugins that allow you to write in the header.

Options available

The options available to choose from before the conversion are:

  • Copy width: If not selected, the width of the cell is entered in the text box on the right.
  • Copy height: If not selected, the height of the cell is entered in the text box on the right.
  • Copy align: Copy text alignment in the cell. If the cell alignment is undefined, it defaults to the center line.
  • Copy background color of the cell.
  • Copy decimals: Copy decimal number. It only makes sense if the cell is defined as the content type ‘Number’. If the type is ‘General’ (default in Excel) will use all decimal places.
  • Copy fonts: Copy the font, color, and weight of the text.
  • Copy borders: Copy the borders and cell colors.

By default, the program performs the full conversion of the Excel sheet. However, each option causes the generated HTML is longer. Disable options that do not need (for example, because you’re going to use CSS styles or generic properties for the table) to reduce code size.

Final thoughts

  • Cells containing formulas can’t be modified in the final HTML code.
  • Taking advantage of this we can define constant value cells (which can’t be modified by the user) by using a simply formula formed by an equality. (Example “= 15”).
  • You can use cells outside the selected range. The program will replace the references to the outer cells by their value, so the formulas will be calculated correctly.
  • The program makes only basic operations, addition, subtraction, multiplication and division. All other Excel functions are not supported.
  • The program does not merge cells. These will be considered as separate cells.
  • The number of decimals has influences in calculations. The values ​​used in the calculation are used after rounding.

And finally tell you that the program is distributed free of charge for personal use. You are free to use as you please. It has been tested and works properly, but I am not responsible if your computer crashes, making you lose data, you computer explodes, or a dinosaur eats your dog.

If you have any questions, suggestions, or you find an error, please notify us. Enjoy it, I hope you find it useful.