JSD
JSD

Reputation: 111

Openpyxl "Numbers Stored as Text"

Background:

Situation:

Question:

I've done some extensive searching on StackOverflow as well as many other sites and can't seem to find a solution that will work for me.

Any insight would be greatly appreciated!

Upvotes: 11

Views: 22269

Answers (1)

Rohit
Rohit

Reputation: 189

As you are getting Numbers Stored as Text error, I believe that the value you are adding in the Excel worksheet is String. Please confirm this by displaying type of your variable.

type(variable_name)

If it is <class'str'>, then add float while passing the variable to Excel sheet.

your_number = '412.5876'
ws['A1'] = float(your_number)

This should fix your problem.

Upvotes: 6

Related Questions