Sync Excel with SharePoint list for Bulk Insert & Update Records.

Arunraj Venugopal
 
SharePoint Developer
March 30, 2015
 
Rate this article
 
Views
46003

By default, Sync excel with Sharepoint list was available with the previous version of excel, but the synch feature is not existing in the excel 2010 version onwards for which in Google, add one synchronization reference should be uploaded in the excel file which is not working.

When we export the sharepoint list into excel, the synchronization option will not be available in the right click properties for which the below macro to be added and executed to get the desire sharepoint list and sync option in the right click properties.

Let us look at the steps to synch excel with sharepoint list.

1. Open an excel file and press Alt +F11. Select Workbook from the list.

clip_image001

2. Following macro to be added in the workbook open method

 Dim ws  As worksheet
 Set ws =thisworkbook.worksheets(1)
 Dim src(1) As Variant
 Src(0) = http://contoso.com/sites/Sitename/Experiments”  & ”/_vi_bin”
 Src(1) =”D28c1csD-F969-47C1-9C0C-61CAEB57C26A” (List Id)
 If ws.listObjects.count = 0 then
 	Ws.ListObjects.Add xlSrcExternal, src,True,xlYes, ws.Range(“A1”)
 Else
   Set ObjListObj=ws.ListObjects(1)
 ObjListObj.Refresh
 End if 
 

The macro will fetch data from the list “Test” in the SharePoint site “experiments” and insert into the excel sheet 1.

3. Go to SharePoint site and the list which has to be sync with excel file. Click Export to Excel

clip_image003

4. Click Enable button

clip_image005

5. Click Data -> Connection->Properties

clip_image007

6. Click Definition tab and copy the content in the Command Text field& close the excel file.clip_image009

7. The value for src(1) is <LISTNAME>{D28C1C5D-F969-47C1-9C0C-61CAEB57C26A}</LISTNAME>

8. The value for src(0) is <LISTWEB>http://Contoso.com/sites/SiteName/Subsite//_vti_bin</LISTWEB>

9. Save the excel file as Excel 97-2003 workbook

clip_image011.

10. Whenever the workbook is opened, the macro get executed and retrieved the SharePoint list into the excel sheet if the macro is enabled by default. Otherwise click enable macro at the top of the excel file.

11. Execute the Update method once the insert or update process is done. Or

Right click on the sheet in which the sharepoint list data retrieved from the SP and select Sync with sharepoint list. In this case, no need to use the below code..

clip_image013

12. Press F8 (line by line execution ) or F5 to execute the macro

13. Refresh the SharePoint list to make sure that the insert / modify records are synchronized with the list

Category : SharePoint

Author Info

Arunraj Venugopal
 
SharePoint Developer
 
Rate this article
 
Works as a SharePoint Developer in a CMM Level 5 Company ...read more
 

Leave a comment