title: Open XML SDK 2.0 to get access to excel 2010 worksheet by name
body: <p>I have an Excel 2010 spreadsheet that has 3 worksheets named Sheet1, Sheet2 and Sheet3. </p>
  
  <p>I'm trying to get a reference to a worksheet by name.</p>
  
  <p>I'm using the code:</p>
  
  <pre><code>using (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open(FileName, true))
  {
      //Access the main Workbook part, which contains all references 
      WorkbookPart workbookPart = myWorkbook.WorkbookPart;
  
      WorksheetPart worksheetPart = workbookPart.WorksheetParts.Last(); 
  
      // this gives me Sheet1
      SheetData sheetData = worksheetPart.Worksheet.GetFirstChild&lt;SheetData&gt;();
  }
  </code></pre>
  
  <p>I am trying to get a reference to Sheet2, but I cannot find a way to do this. </p>
  
  <p>I'm getting closer, but I'm not there yet:</p>
  
  <pre><code>var x = workbookPart.Workbook.Sheets.Where(s=&gt; s.GetAttribute("name", "").Value == "Sheet2").FirstOrDefault();
  </code></pre>
  
  <p>That gets me a reference to the sheet, but not to the data on the sheet</p>
  
  <p>Thanks</p>