How to Insert a Microsoft Excel File Into a Web Page With HTML Code

Techwalla may earn compensation through affiliate links in this story.
Image Credit: undrey/iStock/GettyImages

If you want to include an Excel sheet on a web page, you have several choices. The simplest option is to link to the spreadsheet file and let users download it. You can also use the online version of Excel to embed Excel in the HTML code used to build a website. If you create a PDF version of an Excel sheet, you can also embed or link this on a website.

Linking to an Excel Sheet

One of the easiest ways to share a Microsoft Excel sheet online is to link to it.

Save your Excel file and upload it to your personal or business web space or share it with a file-sharing tool such as Dropbox or Google Drive. Add a link to the Excel sheet on the web page using HTML code or an editing or hosting tool such as WordPress or Medium.

When someone wants to view the sheet, they can view the link and download the spreadsheet to open in a local copy of Excel or another spreadsheet program that's compatible with Excel files. This approach takes a minimum of coding and testing because it doesn't require the web browser to display the spreadsheet.

The downside is that a separate program has to be used to view the spreadsheet file because it isn't shown directly in the web browser.

Show Excel File in HTML

If you have your Excel file on Microsoft OneDrive, you can display an Excel sheet on an HTML page and even let people interact with it to explore the data.

In OneDrive, right-click the file and click "Embed." Click "Generate" and then click "Customize how this embedded workbook will appear to others." Select options for the dimensions of how it should appear on the page, what elements of the file to make visible and what you want to allow users to be able to do, including entering data, sorting and filtering.

Examine the automatically generated preview to make sure the spreadsheet looks the way it should and click "Copy" to copy the embed code into your clipboard. Paste that code into the HTML code if you're coding a website by hand or into your hosting platform to include it on your site.

Google offers similar functionality with Google Sheets, its own spreadsheet platform.

Use a PDF File

Another option is to export the spreadsheet file as a PDF and include this on your website. PDF files can be opened directly in modern web browsers or embedded with tools such as DocumentCloud or Scribd.

Click the "File" menu in Excel and select "Save As." Enter a file name in the "File Name" field. In the "Save as Type" field, select "PDF." Click "Save."

When the file is saved, upload it to your web space or file-sharing platform and link it from your website or embed it with your PDF-embedding tool of choice.

references