vikas95prasad
vikas95prasad

Reputation: 1332

How to render xlsx inside iFrame in reactjs?

Can we render xlsx file in html ?

Should be compatible with the browsers like IE and chrome.

<iframe
 height="500px"
 width="100%"
 src={file.url}
/>

But after the page is loaded this actually downloads the files.

Upvotes: 0

Views: 5501

Answers (2)

vikas95prasad
vikas95prasad

Reputation: 1332

I did it using this API :

https://view.officeapps.live.com/op/embed.aspx?src=http://www.learningaboutelectronics.com/Articles/Example.xlsx

Insert this inside an Iframe you will be able to see excel.

Upvotes: 3

Noman Gul
Noman Gul

Reputation: 397

Excel or .xlsx extension files do not display natively in a browser/iframes.

The closest you could get is to have a library that reads the Excel file and then generates HTML based on its content.

Or

Another solution would be to convert the file to pdf and display it in the iframe.

Upvotes: 1

Related Questions