How to convert column datatyp in excel to String using C#

Norma W 1 Reputation point
2021-04-08T14:06:23.91+00:00

Hello,

I have to convert the column datatype in Excel to String. The column contains scientific notation. Once I used NumberFormat to convert it, the scientific notation is not expanded. Can someone help? I need code. Thanks.
Oker

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,275 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Timon Yang-MSFT 9,576 Reputation points
    2021-04-09T08:22:37.097+00:00

    Is there any difference between getting the scientific notation form and getting the ordinary number form?

    We can easily convert them to each other with c#.

                decimal h = Decimal.Parse( cellValue.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture);  
    

    Moreover, even if it is converted to Text type, its value still is the correct number. Is it different in your case?

    86157-1.png


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments