How to develop a Windows Form Application in visual studio.
The page should read data from the excel file using the OLEDB . If the data in the particular column in excel file matches the "list item" in the SharePoint site then, I need to update other list items in share point site.
Posted May 15, 2012, 11:55 AM
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties=Excel 8.0;"; OleDbConnection oledbConn = new OleDbConnection(connString);
oledbConn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", oledbConn);
OleDbDataAdapter oleda = new OleDbDataAdapter();
oleda.SelectCommand = cmd;
DataSet ds = new DataSet();
oleda.Fill(ds, "exceldata");
using(SPSite site = new SPSite("sharepoint site url"))
{ using (SPWeb web = site.OpenWeb())
{
foreach (DataRow row in ds.Tables[0].Rows)
{
SPList list = web.Lists["YourList"];
SPListItem Item = list.Items.Add();
item["Title"] = row.ItemArray[0].ToString();
item["Description"] = row.ItemArray[1].ToString() item.Update();
} } }
http://spreadsheet2splist.codeplex.com/
Hope this helps you.