Excel Set Cell Value As Text In C#

C# Excel Interop: How to format cells to store values as text

Problem:

Writing to Microsoft Excel Sheet from a program or application where the value is a number with a leading zero.

Solution:

You need to reformat the cells to text format. Using the code below will except ALL values in to the cell as “Text” format


SomeRange.NumberFormat = "@";

Resources:

https://stackoverflow.com/questions/7583704/c-sharp-excel-interop-how-to-format-cells-to-store-values-as-text