Importing Excel Sheet Data Into SharePoint 2007 List RRS feed

  • Question

  • Hi,

    I have 10 columns in Excel file(Sample.xls)  and their names are first,second,third...............ten and there are 20 rows in each
    column and i've a SharePoint 2007 List named as Test and there are ten columns in this list as well and list is filled with data .
    My Requirement is as follows

    I want to write a C# code which can Import the Excel Sheet's all  Data   into the SharePoint 2007 List(Test) but code should be written in the way that first it checks  whether the List is empty or filled with data, if the List is empty then the Code should Import the whole Excel sheet data in that list but if list is filled with data then the code first delete that List(Test) data but the column names should not be deleted only the data which is in the list must be deleted and then import the excel sheet data in that  list.

    Note: First column's data from excel sheet should be inserted into the first column of List,similarly second column data from excel sheet sholud be inserted into the second column of the SharePoint List and so on.

    • Excel Sheet is in 97-2003 version
    • List is of SharePoint 2007 

    can anyone send me the  c# code for this task

    Saturday, March 19, 2011 6:58 AM

All replies

  • This needs to be moved to the Pre 2010 lists.  You need to repost your question there.
    Gary Newman MCSE, MCT, CCNA MCDBA, MCAD, MCSA MCTS SharePoint 2007 Dev & Admin MCPD SharePoint 2010 Development
    Sunday, March 20, 2011 5:03 AM
  • Ok......

    but what if i i've to do a same thing in SharePoint 2010 , so how it would be done.please tell me the c# code .

    Tuesday, March 22, 2011 5:14 AM
  • Hi zubaimasihullah,

    I am also in need of the same requirement. Importing excel data to sharepoint list, Did you find the code in c#, if so kindly let me know.

    Thursday, April 7, 2011 2:59 PM
  • hi,


    have you both found the solution regarding this requirment.


    i have also same exact requirement.if you guys found the solution so i request you please share the solution.


    Thank you

    BestRegards|SharePoint Techies
    Saturday, July 30, 2011 10:28 AM
  • Hi,

    There is a Add in for Microsoft Excel, where in which u can synchronize with the sharepoint list.

    All u have to download the Addin from

    And then open the excel, from the Design tab, click Publish and allow Sync

    Enter the SharePoint site URL, list name and description

    Click Publish

    That's it! You can now update either the Excel spreadsheet or SharePoint list and it will be in sync. Make sure you manually sync Excel with SharePoint by right-clicking within the Excel table and select Table | Synchronize with SharePoint.


    • Proposed as answer by Gachu16 Thursday, July 5, 2012 11:19 PM
    Wednesday, June 6, 2012 10:36 PM