// Creates a new worksheet with the specified name and contents from a memory spreadsheet
 public static void SetSheetContents(SpreadsheetDocument document, WorksheetPart worksheet, MemorySpreadsheet contents)
 {
     XDocument worksheetXDocument = worksheet.GetXDocument();
     worksheetXDocument.Root.Element(S.sheetData).ReplaceWith(contents.GetElements());
     worksheet.PutXDocument();
 }