Hi,
I am using NPOI API to reader data from excel but one of the column in excel has number datatype but in need to convert it to text and read the data.
can someone please help ..
public static DataTable ExcelToDataTable(string filePath)
{
DataTable dt = new DataTable();
//Get the excel sheet based on the file extension(.xls/.xlsx)
ISheet sheet = GetWorkSheet(filePath);
IEnumerator rows = sheet.GetRowEnumerator();
IRow headerRow = sheet.GetRow(0);
int cellCount = headerRow.LastCellNum;
for (int j = 0; j < cellCount; j++)
{
ICell cell = headerRow.GetCell(j);
dt.Columns.Add(cell.ToString());
}
for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)
{
sheet.GetRow(i);
IR ...
Go to the complete details ...