Key Takeaways
- Saving the file as a webpage is the easiest method you may try.
- In most cases, you would need a code editor or Notepad to view the HTML for the converted table.
Method 1: Save as Webpage
Excel lets you save your documents in different formats. One of them is an HTML webpage. You can use this feature to convert an Excel sheet to an HTML document. However, that adds a lot of extra code, which might be unnecessary if you try to convert a simple table. You can remove those extra lines if you are familiar with HTML coding.
Here are the steps to convert Excel to HTML using save as webpage:
Step 1: Launch the Excel sheet that you want to convert.
Step 2: Click the File option at the top and choose Save As. Select the folder where you want to save the generated HTML file.
Step 3: The Save As dialog box will open. Click on the Save as type drop-down box > choose Web page.
Step 4: If you have multiple worksheets, choose Entire Workbook next to the Save option. If it’s a simple table, select Selection > click on Save.
Step 5: Another pop-up window will open. Click on Publish.
The file will be saved as an HTML page. To view its code, follow the instructions given below.
View HTML Code for a Webpage
Navigate to the folder where you saved the HTML file. Then, double-click on it to preview the file in a browser.
To copy the HTML code, right-click on the file and choose Open with. If your HTML editor is installed on your PC, select it, or choose any regular text editor, such as Notepad or its alternatives.
Here’s a snapshot of how the HTML code looks like using this method:
Method 2: Use HTML Editor
One of the simplest methods is to copy the cells from your Excel sheet and paste them into an HTML editor. That will automatically generate the required code for the HTML table. In this example, we use the online HTML editor.
Step 1: Open your Excel sheet. Copy the cells containing your data. Use the Ctrl + C keyboard shortcut to copy the cells.
Step 2: Open any HTML editor and paste the copied cells into the box on the left side.
Immediately when you paste it, the editor will generate your HTML code for the table. It will be a basic table. You can format it later as per your requirements.
Method 3: Using Google Sheets Publish to Web Feature
This will entail opening the Excel file with Google Sheets. Follow the steps below.
Step 1: Open your Google Drive on a browser.
Step 2: Navigate to where you saved the Excel file on your computer and drag and drop it into any location on your Google Drive.
Step 3: Click on the File in your Drive, expand Open with, and select Google Sheets.
Step 4: Click on File > Share > Publish to web.
Step 5: Click Publish, then copy the link.
Step 6: Paste the link in your browser and click Enter.
Step 7: Right-click the page > click Inspect.
Step 8: In the new window, expand tags till you find Table > right-click and select Copy > Copy element.
Now, you may paste the HTML table code into any editor.
Was this helpful?
.happy-face-cls-1{fill:#c9c9c9;}.happy-face-cls-2{fill:#e1e1e1;}.happy-face-cls-3{fill:#676767;}
.sad-face-cls-1{fill:#c9c9c9;}.sad-face-cls-2{fill:#676767;}.sad-face-cls-3{fill:#e1e1e1;}.sad-face-cls-4{fill:#676767;}
Thanks for your feedback!
Categories: How to
Source: thpttranhungdao.edu.vn/en/