Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > read csv file in iframe as text file

Reply
Thread Tools

read csv file in iframe as text file

 
 
sukhmeet@gmail.com
Guest
Posts: n/a
 
      01-15-2008
Hi,
I am trying to load a csv file in Iframe element. I just want to
load it as a text file.
however when i load the file in iframe it asks to open the file and
finally opens it with excel in IE window itself. If i save the save
file as .txt it is being read properly.I need to save the file in csv
format only so that it can be edited externally with excel easily.
Later on i want to display the read csv file in javascript and do some
processing on it.
Does any know how do this. The basic problem is to stop IE from
invoking excel to open csv file and instead read the file as text.

Following code works for .txt file

<iframe name="loader" id="frm" width="1000" height="300"
style="visibility:hidden;display:none" src="Book1.txt"></iframe>

and when i use this line it tries to open the file using excel which i
don't want.

<iframe name="loader" id="frm" width="1000" height="300"
style="visibility:hidden;display:none" src="Book1.csv"></iframe>

Any suggestions?
Thanks
Sukhmeet

 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      01-15-2008
Gazing into my crystal ball I observed http://www.velocityreviews.com/forums/(E-Mail Removed) writing in
news:(E-Mail Removed):

> Hi,
> I am trying to load a csv file in Iframe element. I just want to
> load it as a text file.
> however when i load the file in iframe it asks to open the file and
> finally opens it with excel in IE window itself. If i save the save
> file as .txt it is being read properly.I need to save the file in csv
> format only so that it can be edited externally with excel easily.
> Later on i want to display the read csv file in javascript and do some
> processing on it.
> Does any know how do this. The basic problem is to stop IE from
> invoking excel to open csv file and instead read the file as text.
>
> Following code works for .txt file
>
><iframe name="loader" id="frm" width="1000" height="300"
> style="visibility:hidden;display:none" src="Book1.txt"></iframe>
>
> and when i use this line it tries to open the file using excel which i
> don't want.
>
><iframe name="loader" id="frm" width="1000" height="300"
> style="visibility:hidden;display:none" src="Book1.csv"></iframe>
>
> Any suggestions?
> Thanks
> Sukhmeet
>
>


There really isn't anything you can do - it depends on the user's
browser and system. If the user's system wants to do that, it will.

By the way, .txt files can also be opened by Excel.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
 
 
 
Ben C
Guest
Posts: n/a
 
      01-15-2008
On 2008-01-15, Adrienne Boswell <(E-Mail Removed)> wrote:
> Gazing into my crystal ball I observed (E-Mail Removed) writing in
> news:(E-Mail Removed):
>
>> Hi,
>> I am trying to load a csv file in Iframe element. I just want to
>> load it as a text file.
>> however when i load the file in iframe it asks to open the file and
>> finally opens it with excel in IE window itself. If i save the save
>> file as .txt it is being read properly.I need to save the file in csv
>> format only so that it can be edited externally with excel easily.
>> Later on i want to display the read csv file in javascript and do some
>> processing on it.
>> Does any know how do this. The basic problem is to stop IE from
>> invoking excel to open csv file and instead read the file as text.
>>
>> Following code works for .txt file
>>
>><iframe name="loader" id="frm" width="1000" height="300"
>> style="visibility:hidden;display:none" src="Book1.txt"></iframe>
>>
>> and when i use this line it tries to open the file using excel which i
>> don't want.
>>
>><iframe name="loader" id="frm" width="1000" height="300"
>> style="visibility:hidden;display:none" src="Book1.csv"></iframe>
>>
>> Any suggestions?
>> Thanks
>> Sukhmeet
>>
>>

>
> There really isn't anything you can do - it depends on the user's
> browser and system. If the user's system wants to do that, it will.


Might it depend on the MIME type header delivered with the file? If the
extension is csv the server might send it as application/ms-excel or
something and that's what causes IE to try to open it in Excel? If so
the server can be configured to send it as text/plain instead.

It's equally possible IE itself just looks at the extension and ignores
the MIME type anyway. In which case there's nothing you can do.
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      01-15-2008
On 15 Jan, 07:16, (E-Mail Removed) wrote:

> I am trying to load a csv file in Iframe element. I just want to
> load it as a text file.


Configure your web server so that it serves this file with a Content-
type (MIME type) of "text/plain". This should then be displayed by
the browser. If the content-type is text/csv, application/csv etc.,
then any copies of Excel on the user's desktop are likely to try and
display it instead.

If you can't change the content-type header for .csv in this
directory, just try renaming the file to .txt instead. That will
nearly always cause the server to serve it as text/plain.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
csv read clean up and write out to csv Sacha Rook Python 2 11-02-2012 07:51 PM
read CSV file using csv library Li Chen Ruby 18 03-23-2010 12:44 AM
read csv file in iframe as text file sukhmeet@gmail.com Javascript 5 01-15-2008 02:47 PM
read and write csv file using csv module jliu66 Python 0 10-19-2007 03:12 PM
Get form values from iframe (1) to iframe (2) inside a layer in iframe (1) Daedalous Javascript 3 01-16-2004 11:08 AM



Advertisments