Oct-09-2019, 11:08 AM
(This post was last modified: Oct-09-2019, 01:03 PM by curranjohn46.)
Hi All,
I run the following openpyxl command to wrap text in all rows after row 9. It works fine but throws a deprecation warning. I'd love to figure out how to use documentation such as https://openpyxl.readthedocs.io/en/stable/ to determine the current, non-deprecated, way to wrap_text. But I always find the documentation confusing and unhelpful. For example, if I search for wrap_text I get this: https://openpyxl.readthedocs.io/en/stabl...t.wrapText
But that tells me nothing about how to wrap text. Do I simply not know how to use the documentation? Is there some great mystery I am to unravel so I don't have to endlessly google for examples on how to use openpyxl? How does one look at such documentation and figure out out how to wrap_text in a cell?
Here is the code:
C:\Users\Jcurran\AppData\Local\Continuum\anaconda3\lib\site-packages\ipykernel_launcher.py:10: DeprecationWarning: Call to deprecated function copy (Use copy(obj) or cell.obj = cell.obj + other).
# Remove the CWD from sys.path while we load stuff.
How might I figure out the way to find the information required to use the current (non-deprecated) approach to wrapping text in cells via the documentation at https://openpyxl.readthedocs.io/en/stable/?
I am using Jupyter for my environment. Shift tab or tab doesn't give me anything useful.
Any suggestions? I crave self sufficiency but can't grasp how to navigate the documentation for answer. There must be some clue somewhere? Some source code perhaps that I do not know how to locate?
I run the following openpyxl command to wrap text in all rows after row 9. It works fine but throws a deprecation warning. I'd love to figure out how to use documentation such as https://openpyxl.readthedocs.io/en/stable/ to determine the current, non-deprecated, way to wrap_text. But I always find the documentation confusing and unhelpful. For example, if I search for wrap_text I get this: https://openpyxl.readthedocs.io/en/stabl...t.wrapText
But that tells me nothing about how to wrap text. Do I simply not know how to use the documentation? Is there some great mystery I am to unravel so I don't have to endlessly google for examples on how to use openpyxl? How does one look at such documentation and figure out out how to wrap_text in a cell?
Here is the code:
from openpyxl import load_workbook from openpyxl.styles import Alignment file1 = "C:\\folder\\inputFile1.xlsx" wb=load_workbook(file1) ws = wb.active for rows in ws.iter_rows(min_row=10, max_row=None, min_col=None, max_col=None): for cell in rows: cell.alignment = cell.alignment.copy(wrapText=True) wb.save('C:\\folder\file1_wrap.xlsx')here is the deprecation warning:
C:\Users\Jcurran\AppData\Local\Continuum\anaconda3\lib\site-packages\ipykernel_launcher.py:10: DeprecationWarning: Call to deprecated function copy (Use copy(obj) or cell.obj = cell.obj + other).
# Remove the CWD from sys.path while we load stuff.
How might I figure out the way to find the information required to use the current (non-deprecated) approach to wrapping text in cells via the documentation at https://openpyxl.readthedocs.io/en/stable/?
I am using Jupyter for my environment. Shift tab or tab doesn't give me anything useful.
Any suggestions? I crave self sufficiency but can't grasp how to navigate the documentation for answer. There must be some clue somewhere? Some source code perhaps that I do not know how to locate?