is there a way of importing property data to umbraco content?
Hi,
We have a multilingual website and we are managing the content for our meta keywords, meta descriptions and meta titles in different language also (11 languages).
What I need is to have an excel file that contains all this translation and just have an import button in umbraco to populate the 3 properties (meta keywords, meta descriptions, meta titles)
if (uploadFile.HasFile) { string strFile = MapPath("\\ExcelData\\" + uploadFile.FileName);
uploadFile.SaveAs(strFile);
string strConn = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0", strFile); OleDbConnection con = new OleDbConnection(strConn); OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", con); DataTable dt = new DataTable(); da.Fill(dt);
StringBuilder sb = new StringBuilder(); sb.AppendFormat("<p>input file: {0}</p>", strFile); foreach (DataRow dr in dt.Rows) { DocumentType dct = new DocumentType(1068); umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0); int parent = 1073; Document d = Document.MakeNew(dr["name"].ToString(), dct, u, parent); d.getProperty("price").Value = int.Parse(dr["price"].ToString()); d.getProperty("category").Value = 6; d.getProperty("description").Value = dr["description"].ToString();
I created a seperate dot.net project and this in code behind of a user control. I dont know whether i can upload a zip file here. If you wish i can forward the full project but don't have your email.
is there a way of importing property data to umbraco content?
Hi,
We have a multilingual website and we are managing the content for our meta keywords, meta descriptions and meta titles in different language also (11 languages).
What I need is to have an excel file that contains all this translation and just have an import button in umbraco to populate the 3 properties (meta keywords, meta descriptions, meta titles)
Sherry
Hi Sherry,
Depending how you've setup the structure you might want to check-out CMSImport PRO. This allows you to Import content from and Excel file.
Best,
Richard
Hi Sherry
I used code below to import from excel
if (uploadFile.HasFile)
{
string strFile = MapPath("\\ExcelData\\" + uploadFile.FileName);
uploadFile.SaveAs(strFile);
string strConn = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0", strFile);
OleDbConnection con = new OleDbConnection(strConn);
OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", con);
DataTable dt = new DataTable();
da.Fill(dt);
StringBuilder sb = new StringBuilder();
sb.AppendFormat("<p>input file: {0}</p>", strFile);
foreach (DataRow dr in dt.Rows)
{
DocumentType dct = new DocumentType(1068);
umbraco.BusinessLogic.User u = new umbraco.BusinessLogic.User(0);
int parent = 1073;
Document d = Document.MakeNew(dr["name"].ToString(), dct, u, parent);
d.getProperty("price").Value = int.Parse(dr["price"].ToString());
d.getProperty("category").Value = 6;
d.getProperty("description").Value = dr["description"].ToString();
d.Publish(u);
umbraco.library.UpdateDocumentCache(d.Id);
sb.AppendFormat("{0}<br>", dr["name"]);
}
divTest.InnerHtml = sb.ToString();
}
}
Hi Adi,
Did you create a seperate .NET project for this uploader or you put it inside the umbraco project folder? Because i'm having a problem on this line.
Document d = new Document(1234);
Hi Sherry
I created a seperate dot.net project and this in code behind of a user control. I dont know whether i can upload a zip file here. If you wish i can forward the full project but don't have your email.
bye
is working on a reply...