read csv file in iframe as text file

Discussion in 'HTML' started by sukhmeet@gmail.com, Jan 15, 2008.

  1. Guest

    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
    , Jan 15, 2008
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed writing in
    news::

    > 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
    Adrienne Boswell, Jan 15, 2008
    #2
    1. Advertising

  3. Ben C Guest

    On 2008-01-15, Adrienne Boswell <> wrote:
    > Gazing into my crystal ball I observed writing in
    > news::
    >
    >> 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.
    Ben C, Jan 15, 2008
    #3
  4. Andy Dingley Guest

    On 15 Jan, 07:16, 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.
    Andy Dingley, Jan 15, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jliu66
    Replies:
    0
    Views:
    504
    jliu66
    Oct 19, 2007
  2. Li Chen
    Replies:
    18
    Views:
    653
    Azmi Farih
    Mar 23, 2010
  3. Daedalous
    Replies:
    3
    Views:
    677
    Daedalous
    Jan 16, 2004
  4. Replies:
    5
    Views:
    231
    Doug Gunnoe
    Jan 15, 2008
  5. Sacha Rook

    csv read clean up and write out to csv

    Sacha Rook, Nov 2, 2012, in forum: Python
    Replies:
    2
    Views:
    217
    Hans Mulder
    Nov 2, 2012
Loading...

Share This Page