PowerShell – upload CSV file to List (both Server and Client OM)

February 26, 2012 by spjeff

Recently I had a friend ask about how to upload a local CSV data file to a SharePoint site.  The scenario is that a daily CSV file is provided on a network share and needs to be imported to SharePoint for viewing, filtering, and sorting.  The easiest way to code this was with Server Side Object Model.  Be sure to compare the source/destination columns and make sure everything lines up OK.   The schema must match for any import to be successful.

This also can be accomplished with Client Side Object Model, it just takes a little more code.   If you don’t have access to the SharePoint server this is a great option with flexibility to host a PowerShell script anywhere (desktop, job server, etc.)

 

2-24-2012 3-32-35 PM

2-24-2012 3-31-46 PM

http://itbloggen.se/cs/blogs/daniel/archive/2009/01/28/screencast-empowering-sharepoint-using-powershell-part-1.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/22/use-powershell-to-manage-lists-views-and-items-in-sharepoint.aspx

 

Server Side Object Model

Client Side Object Model