Click here to Skip to main content
15,745,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I need help on this as the code are able to display in IE but not in Chrome.
HTML
<pre><html xmlns="" xml:lang="en" lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
</object>
<div align="center"><iframe src="C:\y\test.csv" width="50%" height="200"></iframe></div>
</body>
</html>


What I have tried:

I've tried it in Chrome, it does not display but directly download the excel file instead, any idea how to fix it? Your help are very much appreciate, thanks in advanced!
Posted
Updated 7-Dec-21 19:10pm

Firstly, CSV files are not Excel files they are text.

Secondly, linking to a file on the c: drive will not work in a server environment.

Thirdly, to show CSV files in the browser requires some kind of software that the browser understands i.e. a javascript module to be loaded (in the case of IE it will use ActiveX to open Excel if you have it installed), try : GitHub - derekeder/csv-to-html-table: Display any CSV (comma separated values) file as a searchable, filterable, pretty HTML table[^]
 
Share this answer
 
Comments
j9010 3-Apr-18 20:31pm    
Thanks guys! Will give it a try and will reply here when I found the solution =)
Your HTML is broken: a closing <object> tag after the <body> that was never opened.

Meanwhile - I don't use IE - but is there a setting (possibly built-in) that tells it to open a CSV file with Excel? It's really a text file and should be opened as such (by Chrome, FoxPro, etc.).

Let's suppose it were an Excel file: my FireFox opens Excel by downloading it and then opening it with Excel (that is the system's default for xls/xlsx files. If you expand your knowledge to PHP, you can make an ODBC connection to the Excel file and read the date as if it were a database table. Output, then, is then any way you wish, such ans an HTML <table> element
 
Share this answer
 
Comments
j9010 3-Apr-18 20:31pm    
Thanks guys! Will give it a try and will reply here when I found the solution =)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900