Using R to Connect to a Sharepoint List

Using R to connect to a sharepoint list

I've been working on reading SharePoint 2010 lists using R for a little while now. Basically, I use the SharePoint web service to return the results from the list, then use xmlToDataFrame to convert to a dataframe.

URL <- "http://yoursharepointserver/_vti_bin/ListData.svc/yourlist"    
data = xmlParse(readLines(URL))

## get the individual list items
items = getNodeSet(data, "//m:properties")

## convert to a data frame
df = xmlToDataFrame(items, stringsAsFactors = FALSE)

Since I'm using the web service I can filter the list before I return the results, which is really helpful in overcoming the limitations of the SharePoint web service. The following link is quite helpful...
http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/01/21/introduction-to-querying-lists-with-rest-and-listdata-svc-in-sharepoint-2010.aspx

Accessing Excel file from Sharepoint with R

I use

library(readxl)
read_excel('//companySharepointSite/project/.../ExcelFilename.xlsx', 'Sheet1', skip=1)

Note, no https:, and sometimes I have to open the file first (i.e., cut and paste //companySharepointSite/project/.../ExcelFilename.xlsx into my browser's address bar)



Related Topics



Leave a reply



Submit