How to Use a Spreadsheet to Populate a Web Page

By Kevin Lee

Use copy and paste to share important spreadsheet data on the Web.
i Comstock Images/Comstock/Getty Images

When you need to share important spreadsheet information on the Web, Microsoft Excel can help you do it. Excel has a convenient “Save As” feature that allows you to save selected cells as a Web page. The page it creates contains an HTML table that looks like the cells you selected in your spreadsheet. By performing a quick copy and paste operation, you can copy the table that Excel creates and place it anywhere you like in one of your business site’s Web pages.

Create HTML Table

Launch Excel and open a spreadsheet that contains cells you'd like to convert into an HTML table. Highlight those cells.

Click "File" and select "Save As." Click the "Save As Type" drop-down menu and select "Web Page (_htm,_html)."

Type a name in the "File Name" text box and click the "Selection" radio button. The cell range you highlighted appears next to that button. By clicking "Selection" instead of "Entire Workbook," you tell Excel to create a Web page that contains only the cells you highlighted.

Click "Publish" and then click "Publish" again to create your HTML file.

Add Table to Web Page

Launch Windows Explorer and navigate to the folder that contains the HTML file you created. Right-click the file, click “Open With” and then click “Notepad” to open the file in Notepad.

Review the HTML code in the file. It contains an opening <style> and a closing </style> tag. The code that appears between those two tags defines the style of the table that Excel created. Copy everything that appears between the two tags including the tags themselves. When you’re done, the code you copied might appear as shown below:

<style id="Book1_1571_Styles"> {padding-top:1px; color:black; font-size:11.0pt; text-align:general; </style

Launch your HTML editor or another instance of Notepad and open your HTML document. Move to the document’s <head> section and paste the code you copied into that section.

Return to the other Notepad document that contains the Excel HTML code and find the document’s opening <div> tag and its closing </div> tag. The code between those two tags defines your table.

Copy everything that appears between those two tags including the tags themselves. After you do that, the code you copied may look like the following code:

<div id="Book1_1571" align=center x:publishsource="Excel"> <table border=0 cellpadding=0 cellspacing=0 width=192 style='border-collapse: collapse;table-layout:fixed;width:144pt'> <tr height=19 style='height:14.4pt'> <td height=19 class=xl151571 width=64 style='height:14.4pt;width:48pt'>State</td> <td class=xl151571 width=64 style='width:48pt'>City</td> </tr> <tr height=19 style='height:14.4pt'> <td height=19 class=xl151571 style='height:14.4pt'>Florida</td> <td class=xl151571>Miami</td> </tr> </table> </div>

The text you see will depend on the data you copied from Excel.

Return to the other Notepad document that contains your Web page’s HTML code and find that document’s <body> section. Click the location within the body section where you’d like the Excel table to appear and paste the code you copied into that location.

Save the document and view it in your browser. Your Web page will display your Excel data in a table at the location you specified.


If you’d like the table that appears on your Web page to have colors and other formatting, apply that formatting to your Excel cells before saving them as an HTML document. Excel will remember those styles and incorporate them in the code it generates and places in the <style> section.