Hi,
Thanks for your feedback.
If the format of every cell in one column is same, you can check the format of column, if the format is "
#,##0.00", you can set new format("
0.00") to column. I put complete code below for your reference.
- Code: Select all
// Create a Workbook object
Workbook workbook = new Workbook();
// Load the workbook from a file
workbook.LoadFromFile(@"../../data/modifyFormat.xlsx");
// Get the first worksheet from the workbook
Worksheet worksheet = workbook.Worksheets[0];
// Print the current number format of the first column
Console.WriteLine(worksheet.Columns[0].NumberFormat);
// Check if the number format of the first column is "#,##0.00"
if (worksheet.Columns[0].NumberFormat == "#,##0.00")
{
// If yes, change it to "0.00"
worksheet.Columns[0].NumberFormat = "0.00";
}
// Save the worksheet as a CSV file with comma as the delimiter and using UTF-8 encoding
worksheet.SaveToFile(@"../../output/rest.csv", ",", Encoding.UTF8);
Sincerely
Abel
E-iceblue support team