Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# Read Excel columns header return to list

 /// <summary>
        /// Read excel columns header return to List
        /// </summary>
        /// <param name="file">ecel file path</param>
        /// <returns>List</returns>

///Note 1. Install-Package Epplus, 2. Use OfficeOpenXml namespace
        public static List<string> ReadExcelHealdersStoretoList(FileInfo file)
        {
            List<string> excelColumns = new List<string>();
            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

            //Read excel columns headers store to list
            using (var package = new ExcelPackage(file))
            {
                ExcelWorksheet workSheet = package.Workbook.Worksheets[0];
                foreach (var firstRC in workSheet.Cells[1, 1, 1, workSheet.Dimension.End.Column])
                {
                    excelColumns.Add(firstRC.Text);
                }
            }

            return excelColumns;
        }
Comment

PREVIOUS NEXT
Code Example
Csharp :: crystal reports convert decimal to integer in formula 
Csharp :: changing color of material of renderer with multiple materias 
Csharp :: wetter warendorf 
Csharp :: c# copy each property 
Csharp :: photon2 what is a stream 
Csharp :: c# force arguments to be keywords 
Csharp :: eleventy set default layout 
Csharp :: texture matrix 
Csharp :: rest api in c# 
Csharp :: custom vscode snippet 
Csharp :: unity bool to int 
Csharp :: how to round in c# 
Csharp :: c# loop backwards 
Csharp :: array in unity 
Csharp :: how to get day name from datetimepicker in c# 
Csharp :: c# is not marked as serializable 
Csharp :: c# code process to start any exe application 
Csharp :: stackpanel opacity mask from resources wpf 
Csharp :: c# .net stringify data query 
Html :: html grundgerüst 
Html :: disable spell check html 
Html :: html hello world 
Html :: call link html 
Html :: python find remove html tags 
Html :: taka html code 
Html :: bootstrap display inline block 
Html :: html shell 
Html :: adding image in html 
Html :: font awesome cdn link 
Html :: tailwind css textarea 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =