Openpyxl “Numbers Stored as Text”

后端 未结 1 1782
无人共我
无人共我 2021-01-19 15:24

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.

Background: - New to Pyth

相关标签:
1条回答
  • 2021-01-19 16:11

    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 int while passing the variable to Excel sheet.

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

    This should fix your problem.

    0 讨论(0)
提交回复
热议问题