Free Support Forum -

Save excel as tab delimeted - values in scientific notation end up in the tab delimeted file


I am using the following code to save an excel file as a tab-delimited one.

//open the excel file, trim all lines before the header row/column start, then save as a tab-delimited file
Workbook wb = new Workbook();

string inputFileName = "./Employees with Birth Date as last col.xlsx";
string sCleanedFileName = Path.GetDirectoryName(inputFileName) + "\\" + Path.GetFileNameWithoutExtension(inputFileName)
+ "_cleaned" + Path.GetExtension(inputFileName);

//open the specified worksheet
Worksheet ws = wb.Worksheets[0];

wb.Save(sCleanedFileName, FileFormatType.TabDelimited);

Take a look at the file with _cleaned suffix ( it's a tab - delimited file - so open in notepad). Note the value in the scientific notation.

Since I am traversing the excel file cell by cell, is there a property on the workbook / worksheet to force the data in scientific notation to be written in the string format.


Nakul Ringshia


Please see the code below. I have converted the Contact column to general format and then saved the workbook in tab delimited format.

Please see the output txt file and also see the screenshot.


string fpath = @“F:\Downloads\Employees+with+Birth+Date+as+last+col.xlsx”;

Workbook workbook = new Workbook(fpath);

int idx = workbook.Styles.Add();

Style st = workbook.Styles[idx];

st.Number = 0; //Apply General format

Worksheet worksheet = workbook.Worksheets[0];

StyleFlag stFlag=new StyleFlag();


worksheet.Cells.Columns[1].ApplyStyle(st, stFlag);

workbook.Save(fpath + “.out.txt”, SaveFormat.TabDelimited);