coolcake
coolcake

Reputation: 2967

how to display excel sheet in html page

I want to display EXCEL sheet embedded in IE with plain HTML. I have gone through other questions on stackoverflow but could not find any useful one.

Here is my html file

<html>
<body>
<object  width = 900 height = 500 id = "excel"  data="Issues Identified.xlsx" classid = "clsid:0002E55a-0000-0000-C000-000000000046" VIEWASTEXT  >
<param name="DisplayTitleBar" value=true />
<param name="DataType" value="CSVURL"/>
<param name="AutoFit" value="0"/>
<param name="DisplayColHeaders" value="1"/>
<param name="DisplayGridlines" value="1"/>
<param name="DisplayHorizontalScrollBar" value="1"/>
<param name="DisplayRowHeaders" value="1"/>
<param name="DisplayTitleBar" value="1"/>
<param name="DisplayToolbar" value="1"/>
<param name="DisplayVerticalScrollBar" value="1"/>
<param name="EnableAutoCalculate" value="0"/>
<param name="EnableEvents" value="0"/>
<param name="MoveAfterReturn" value="1"/>
<param name="MoveAfterReturnDirection" value="0"/>
<param name="RightToLeft" value="0"/>
</object>
</body>
</html>

Unfortunately I do not have control on the excel files that are generated. If I would have control on the excel files I could have have saved them as web pages and included in the browser. Now I doubt if by any way through above code I can embed excel sheet directly in the web browser. There are many links on web but found not find one which directly loads a excel sheet in to the browser. The ones that are there are using javascript to generate graphs and all instead of displaying an excel sheet which is already present.

When I try to load the excel sheet through above code. I get the following screen

enter image description here

When I use IFRAME the excel sheet is not shown as embedded file but prompting to download or open. I want it to open embedded in the internet explorer.

Any help much appreciated.

Thanks

Upvotes: 18

Views: 242768

Answers (11)

user3400333
user3400333

Reputation: 1

from here you can easily convert your excelsheet data into the html view

Upvotes: 0

abid khan
abid khan

Reputation: 1

If you are making a link <a href='file.htm'>link name</a> or place an iframe tag, it will show the excel data on web but you can't make changes to it.

Every time you make changes in the Excel sheet you have to save again with the same name so it will replace file, and will show the result. The <a> tag file name extension should be .htm

Upvotes: 0

Szundi
Szundi

Reputation: 317

Maybe you might try the web to send the file with proper Content-Type header and with the header like this:

Content-Disposition: inline; filename="xxx.xxx"

Here is a discussion about these headers: How to force files to open in browser instead of download (pdf)?

Or just search on google for content-disposition.

Upvotes: 0

David Jones - iPushPull
David Jones - iPushPull

Reputation: 2879

You can use iPushPull to push live data direct from an Excel session to the web where you can display it in an IFRAME (or using a WordPress plugin, if applicable). The data in the frame will update whenever the data on the sheet updates.

The iPush(...) in-cell function pushes data from Excel to the web.

This support page describes how to embed your Excel data in your website.

Disclaimer - I work for iPushPull.

Upvotes: 1

Tom
Tom

Reputation: 459

Office 365 and OneDrive offer an embed feature. You can then include via IFrame.

I found that setting the iframe height and width to 100% works best. That way on ipad or any device for that matter it fits the screen.

<body style="margin:0px;padding:0px;overflow:hidden">
    <iframe src="embed url" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe>
</body>

Upvotes: 1

Wolfgang Kuehn
Wolfgang Kuehn

Reputation: 12926

Note that Office Web Components are dead, see does-office-xp-web-components-compatable-with-windows-7. OWC was discontinued from XP onward for security reasons.

Since then, and only recently, Microsoft pushes Excel Web App as alternative (a poor alternative IMHO)

As a side note: Microsoft also deprecated the other way round, i.e. embedding the webbrowser control into an excel sheet, see adding-web-browser-control-to-excel-2013. As an alternative Microsoft offers Office Apps (a very limited alternative with respect to interfacing Excel and IE)

Upvotes: 0

Irfanullah Jan
Irfanullah Jan

Reputation: 3892

Upload your file to Skydrive and then right click and select "Embed". They will provide iframe snippet which you can paste in your html. This works flawlessly.

Source: Office.com

Upvotes: 3

iotapaw
iotapaw

Reputation: 41

Depending on if you want it to automatically update or not, you can just save the excel spreadsheet as a PDF then embed the PDF as an object -

It appears you don't have a PDF plugin for this browser, but you can click here to download the PDF file.

It's the best way I have found for uploading.

Upvotes: 4

Tony Dallimore
Tony Dallimore

Reputation: 12403

Like you, I cannot get MS Office Web Components to work. I would not consider Google Docs since Google seems to think they own anything that passes through their hands. I have tried MS Publish Objects but the quality of the generated html/css is truely awful.

The secret of converting an Excel worksheet to html that will display correctly on a smartphone is to create clean, lean html/css.

The structure of the HTML is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    HEAD
  </head>
  <body>
    BODY
  </body>
</html>

There are useful html elements that can replace "HEAD" but it is not clear to me how you would generate them from an Excel worksheet. They would need to be added separately.

The obvious output for a worksheet or a range is an html table so the following assumes BODY will be replaced by an html table.

The structure of an html table is:

<table TABLE-ATTRIBUTES>
  <tr TABLE-ROW-ATTRIBUTES>
    <td TABLE-CELL-ATTRIBUTES>CELL-VALUE</td>
    More <td>...</td> elements as necessary
  </tr>
  More <tr>...</tr> as necessary
</table>  

Include as few TABLE-ATTRIBUTES, TABLE-ROW-ATTRIBUTES and TABLE-CELL-ATTRIBUTES as possible. Do not set column widths in pixels. Use css attributes rather than html attributes.

A table attribute worth considering is style = "border-collapse: collapse;". The default is separate with a gap around each cell. With collapse the cells touch as they do with Excel.

Three table attribute worth considering are style="background-color:aliceblue;", style="color:#0000FF;" and style="text-align:right;". With the first, you can specify the background colour to be any of the fifty or so named html colours. With the second, you can specify the font colour to be any of 256*256*256 colours. With the third you can right-align numeric values.

The above covers only a fraction of the formatting information that could be converted from Excel to html/css. I am developing an add-in that will convert as much Excel formatting as possible but I hope the above helps anyone with simple requirements.

Upvotes: 1

kingjeffrey
kingjeffrey

Reputation: 15260

You can upload it into Google Docs, and embed the Google Spreadsheet as detailed here: http://support.google.com/docs/bin/answer.py?hl=en&answer=55244

Upvotes: 3

user1237385
user1237385

Reputation:

Try this it will work...

<iframe src="Tmp.XLS" width="100%" height="500"></iframe>

But you can not save changes that you have done...It is used only for displaying purpose..

Upvotes: -4

Related Questions