2

I am using c# .net. I am creating a new excel file from scratch. Some of the cells contain text and some of the cells contain number. How can I set using C# ExcelPackage a cell's type as number?

Michael Blok
  • 221
  • 1
  • 4
  • 15

1 Answers1

0

This should work:

// Get the entire column you want (in this example column A)
var range = someWorkSheet.get_Range("A:A");  
// Set the format to numbers
range.NumberFormat = "0";

(If you want to set it as text instead, then range.NumberFormat = "@";)

Halvard
  • 3,891
  • 6
  • 39
  • 51