OpenPyXL - Reading in Data, Not Formulas, in Excel Workbooks with Python | Data Automation

preview_player
Показать описание
This video demonstrates how to use the data_only parameter in the load_workbook function to bring into memory just the values contained in the cells rather than the formulas that produce those values. I use Anaconda's Jupyter Lab interface.

😄 Please consider supporting this channel and making this content possible:

00:00 :: Intro and workbook review
00:48 :: Reading in data & formulas
01:07 :: Reading in data only
02:07 :: Overview

PythonExcelTutorial #openpyxl #DataAutomation #python #pythontutorial #excel #pythonautomation #pythonprogramming #data #jupyterlab
Рекомендации по теме
Комментарии
Автор

I try this but I'm still confusing, the first time I try, the code works fine and I get the value not the formulas, but when try for second time the code not works and return value as '' alias None. But thanks for the videos!

KangGadget
Автор

I have 2 cells, [C5] contains "Vor_1" and [C6] contains "=C5". I think there is a bug because with data_only=True my ws[C6].value is None when I would want it to be Vor_1. I checked ws[C6].data_type which returned 'n' while data_type for [C5] returned 's' which I think may explain where the bug could be. Have you seen this or figured out a way past it?

PeterMoore-wy
Автор

Very helpful. I have one question: I created a new column where the rows contain the calculated results from a formula dividing the values of one column by 100, and it all work s fine. But when I try copying across these values to another workbook column, openpyxl only copies the formulas across. How do I debug this please?

josephineaburorobi