Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

SharePoint: Opening CSV files with Microsoft Excel

with 10 comments

By default, if open a .CSV file in a SharePoint the browser will prompt you to save the file. Ideally, you probably want the file to be opened directly in Microsoft Excel. There are two configuration options that need to be made. The instructions here are for SharePoint 2010 but are similar for SharePoint 2007.

  • Add an entry to DOCICON.XML

This file is located by default at: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML. Open the file DOCICON.XML for editing and add the following line in the ByExtension element:

<Mapping Key=”csv” Value=”icxltx.png” OpenControl=””/>

This ensures that the Excel icon is displayed alongside CSV files.

Note: if you want to be prompted to open read-only or for edit remove ‘OpenControl=”” ‘ in the Mapping Key.

  • Change the MIME type associated with the CSV Extension in Internet Information Server (IIS)

To do this:

  1. Run the “Internet Information Services (IIS) Manager” application from the Start/Administrative tools menu.
  2. Select the server in the left-hand pane.
  3. Select “MIME Types” in the list of options in the middle pane.
  4. Then locate the .CSV entry (it should already exist) and change the MIME type to: application/vnd.ms-excel, and click OK.

Once these configuration options are complete perform an IIS Reset.

CSV files should now be opened using Excel by default. You will be prompted that a change in file extension has occurred when using Office 2007. You will need to click Yes in this warning message.

About these ads

Written by Nick Grattan

January 5, 2011 at 9:11 am

10 Responses

Subscribe to comments with RSS.

  1. Was not able to get this to work.
    The XML file changed all excel files to not be rendered properly.
    Removing the csv file entry from the XML file restorted the excel file.

    Thoughts?

    Walt Fles

    July 21, 2011 at 12:42 pm

  2. Nick,

    We are using SharePoint 2007 and I have this issue. Only when I look in the folder: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14. There is no TEMPLATES folder where Docicon.xml.

    Is there something that I can get this folder?

    Thx

    Sander

    August 23, 2012 at 1:43 pm

    • Hi Sander,

      This should be the “12” folder for SharePoint 2007 – thanks for pointing this out and I’ve updated the post. (The “14” folder is used with SharePoint 2010).

      Regards,

      Nick.

      Nick Grattan

      August 23, 2012 at 2:42 pm

      • Thanks for your fast reply Nick. The only thing is that I have the “12” folder only there is no Templates folder. Does the folder exist on the client side or on the server side?

        Thx

        Sander

        August 23, 2012 at 3:17 pm

      • Hi Sander, It’s on the SharePoint server. Regards, Nick.

        Nick Grattan

        August 24, 2012 at 6:52 am

  3. Good Morning –

    For the record this work around does not appear to work in SharePoint 2013. Has anyone gotten this to work on their SP2013 servers? If so, please post here the instructions if you do not mind. Thanks.

    Mike

    November 13, 2013 at 3:02 pm

    • I too am looking for this to work in SharePoint 2013. If anyone has a solution, would appreciate a reply!

      Larry

      May 15, 2014 at 4:47 pm

      • Was looking for something else and just ran across this, brings to mind, there’s a power shell command for sharepoint 2013 to set this setting for doing the same thing with .mht and PDF files. It’s a web-app level setting that has to do with opening specific mime types, “inline”, with the browser. $webapp.AllowedInlineDownloadedMimeTypes.Add(“application/pdf”)
        Example is for PDF files, haven’t tried this yet for .csv files though, so not sure, but worth a try.

        Anon

        June 28, 2014 at 5:31 pm

  4. Yep I tried this in SP2013 and it does not work. – The server had a WOPI binding to Office Web Apps but I am not sure this is significant .

    In DOCICON.XML I added this entry ( with enclosing tags)
    Mapping Key=”.csv” Value=”icxlsx.png” EditText=”Microsoft Excel” OpenControl=”SharePoint.OpenDocuments” OpenApp=”ms-excel”

    for the IIS/7/5 MIME Type

    .csv
    MIME Type
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

    ….. Sadly after many IISRESETS it still does not work. Annoying.

    westerdaled

    October 22, 2014 at 8:07 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 59 other followers

%d bloggers like this: