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…
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:
- Open an Excel spreadsheet, click on the main menu, and select ‘Options’.
- Select the tab ‘Complements’ and click ‘Go’.
- 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.
- Excel2html will be available in the Ribbon, in the ‘Complements” tab.
The following pictures show the process. (click images to enlarge).
Using the program is very easy, you just need to click two buttons. The step by step instructions are as follows:
- Select the cells you want to convert.
- Starts Excel2Html addin, select the options you want.
- Press ‘Make’. The program converts the cells in HTML. The process can take a few seconds, if the selection is large. Please, be patient.
- The code appears in the program. Click ‘Copy’ button to copy the text to the clipboard.
- Press ‘Exit’ button to close the program.
- Go to your HTML editing program and paste the generated code. The html code generated has two parts.
- The form part (between form and /form tag) must be inserted in the body of the page (between body and /body tags)
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.
- 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.