Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Openxml row count

using (SpreadsheetDocument myDoc = SpreadsheetDocument.Open("PATH", true))
 {
   //Get workbookpart
   WorkbookPart workbookPart = myDoc.WorkbookPart;

   //then access to the worksheet part
   IEnumerable<WorksheetPart> worksheetPart = workbookPart.WorksheetParts;

   foreach (WorksheetPart WSP in worksheetPart)
   {
      //find sheet data
      IEnumerable<SheetData> sheetData = WSP.Worksheet.Elements<SheetData>();       
      // Iterate through every sheet inside Excel sheet
      foreach (SheetData SD in sheetData)
      {
           IEnumerable<Row> row = SD.Elements<Row>(); // Get the row IEnumerator
           Console.WriteLine(row.Count()); // Will give you the count of rows
      }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# order of initialization 
Csharp :: Filter list contents with predicate (anonymous method) 
Csharp :: sequelize instance method is not a function 
Csharp :: convert relative path to physical path c# 
Csharp :: c# datatable column alias 
Csharp :: PasswordBox Helper 
Csharp :: c# statements 
Csharp :: serenity.is get entity columns as ienumerable string 
Csharp :: Count Possible Decodings 
Csharp :: c# class where T : enum 
Csharp :: list.SkipWhile in c# 
Csharp :: "??" in C# 
Csharp :: function documentation c# exception 
Csharp :: c# md5 hash bouncycastle encypt decrypt with key 
Csharp :: get the next letter after specific character in c# 
Csharp :: c# how to load type of class from string 
Csharp :: querstring fromat asp.net c# 
Csharp :: windows forms add onclick 
Csharp :: xamarin forms uwp button hover 
Csharp :: alpahbet incremnet in c# 
Csharp :: C# return json data from File 
Csharp :: c# initialize event 
Csharp :: c# supplier equivalent 
Csharp :: linq query languages 
Csharp :: unity button hover 
Csharp :: version string c# 
Csharp :: How to convert output of HttpClient PostAsJsonAsync() into user defined list of object 
Csharp :: asp.net web hooks 
Csharp :: c# download to string 
Csharp :: get web api relative path 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =