Not a direct answer to your question, but you might find it quicker to use Richard's excellent umbImport tool, available in the projects section of the site.
The umbImport tool looks great, I tried to convert my excel to csv to import it this way but it threw an exception, so I gave up on it. But maybe Ill try to convert the spreadsheet to xml. Only problem is I havn't been able to find out how the xml should be formatted.
csv shouldn't be a problem. Check the exported format and apply the csv settings when uploading teh csv in umbImport. You can use xml also. The xml method accepts only elements..
ServerTimeout in document creation
Hi.
Im currenttly trying to read in some data from a spreadsheet into our umbraco solution.
It is 213 nodes I need to create, but I keep getting a ServerTimeout Exception every 2. time I try to read in the data.
Anybody experienced this when trying to create a large amount of documents?
Heres my code:
protected void Commit_Spreadsheet(object sender, EventArgs e) { string excelpath = httpcontext.Server.MapPath("/media/" + Spreadsheet.FileName); Base.Print(excelpath); Spreadsheet.SaveAs(excelpath); DataSet ds = FonqiCode.NET.Change.ExcelToDataSet(excelpath, "Total"); Base.Print(ds.Tables[0].Rows.Count); int counter = 1; DocumentType dt = DocumentType.GetByAlias("Contact"); User u = new User(0); foreach (DataRow dr in ds.Tables[0].Rows) { if (!String.IsNullOrEmpty(dr[0].ToString())) { Document kontact = Document.MakeNew(dr[0].ToString(), dt, u, contactsFolderNodeId); kontact.getProperty("Name").Value = dr[0]; kontact.getProperty("Title").Value = dr[1]; kontact.getProperty("Email").Value = dr[2]; kontact.Save(); //contact.Publish(u); //umbraco.library.UpdateDocumentCache(contact.Id); //Base.Print((counter++) + " " + dr[0] + ", " + dr[1] + ", " + dr[2]); } } //umbraco.library.UpdateDocumentCache(contactsFolderNodeId); Base.Print("Done"); }
Best regards
Sune Fengel
Not a direct answer to your question, but you might find it quicker to use Richard's excellent umbImport tool, available in the projects section of the site.
cheers,
doug.
The umbImport tool looks great, I tried to convert my excel to csv to import it this way but it threw an exception, so I gave up on it. But maybe Ill try to convert the spreadsheet to xml. Only problem is I havn't been able to find out how the xml should be formatted.
-Best regards
Sune Fengel
Hi Sune,
csv shouldn't be a problem. Check the exported format and apply the csv settings when uploading teh csv in umbImport. You can use xml also. The xml method accepts only elements..
Cheers,
Richard
Hi Richard
Thanks for the great tool.
I managed to tweak my csv file and save it as utf-8 and successfully imoprted all my data.
So thanks for the help also.
- Best regards
Sune Fengel
is working on a reply...