Skip to content
Advertisement

Solving for the average values of cells using openpyxl

How can i obtained the average of the values from B2:B1500 as shown in the code below.

JavaScript

This is the error i am getting

JavaScript

Advertisement

Answer

In this case, you are adding the Cell Objects with an integer, so in this case, we need to get the cell’s value. So, one way to get the value is to extract it from the object itself with cellObj.value.

By modifying your code, we can do this, namely by appending the value instead of the cell object itself.

JavaScript

Note: Again, I haven’t tested it.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement