I have created an Open XML document file
in Existing Spreadsheet document open then read the 1st column value in this file.
- SpreadsheetDocument spreadsheetDocument =
- SpreadsheetDocument.Open(srcFile, true);
- WorksheetPart newWorksheetPart = spreadsheetDocument.WorkbookPart.AddNewPart
(); - newWorksheetPart.Worksheet = new Worksheet(new SheetData());
- WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
- Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook.GetFirstChild
(); - string relationshipId = spreadsheetDocument.WorkbookPart.GetIdOfPart(newWorksheetPart);
- uint sheetId = 1;
- SheetData sheetData = newWorksheetPart.Worksheet.GetFirstChild
(); - IEnumerable
worksheetPart = workbookPart.WorksheetParts; - int rocount=0;
- Sheet sheet = workbookPart.Workbook.Descendants
() - .Where(s => s.Name == "Survey Details").FirstOrDefault();
- foreach (WorksheetPart WSP in worksheetPart)
- {
- //find sheet data
- IEnumerable
sheetData1 = WSP.Worksheet.Elements (); - // Iterate through every sheet inside Excel sheet
- foreach (SheetData SD in sheetData1)
- {
- IEnumerable
row = SD.Elements
(); // Get the row IEnumerator
- IEnumerable
column = SD.Elements (); - var d = column.Count();
- rocount=(row.Count()); // Will give you the count of rows
- }
- }
how to read column value in c#

Sreekanth ReddyRank #726 · 3.2K reputationPosted Nov 18, 2018, 10:53 PM EST
Sanwar RanwaRank #23 · 44.7K reputationPosted Nov 18, 2018, 8:37 PM EST
Kalyani ShevaleRank #1,111 · 1.7K reputationPosted Nov 18, 2018, 8:49 PM EST
Kalyani ShevaleRank #1,111 · 1.7K reputationPosted Nov 18, 2018, 10:22 PM EST
Sanwar RanwaRank #23 · 44.7K reputationPosted Nov 18, 2018, 10:29 PM EST
Kalyani ShevaleRank #1,111 · 1.7K reputationPosted Nov 18, 2018, 10:45 PM EST
Kalyani ShevaleRank #1,111 · 1.7K reputationPosted Nov 18, 2018, 11:17 PM EST
Sreekanth ReddyRank #726 · 3.2K reputationPosted Nov 18, 2018, 11:30 PM EST
Kalyani ShevaleRank #1,111 · 1.7K reputationPosted Nov 18, 2018, 11:54 PM EST
Sreekanth ReddyRank #726 · 3.2K reputationPosted Nov 18, 2018, 11:59 PM EST
Kalyani ShevaleRank #1,111 · 1.7K reputationPosted Nov 19, 2018, 12:13 AM EST
Laxmidhar SahooRank #383 · 6.6K reputationPosted Nov 19, 2018, 5:07 PM EST