hi people!
I'm new using python and openpyxl, and i was trying to iterate over some columns and i had some trouble.
i was trying to make an dictionary with some data from a sheet.
the collumn CNPJ (column B) and column EMPRESA
This is the code:
| cnpj_nome = {} Dictionary |
| for coluna_1, coluna_2 in folhas.iter_rows('B{}:B{}','C{}:C{}' .format(folhas.min_row + 1, folhas.max_row, |
| folhas.min_row + 1, folhas.max_row)): |
| for celula_1, celula_2 in coluna_1, coluna_2: |
| cnpj_nome[celula_1.text] = celula_2.text |
| print(cnpj_nome) |
and, this is the error:
"/home/kylefelipe/Dropbox/notifica_tax/notificar_tax/lib/python3.6/site-packages/openpyxl/worksheet/worksheet.py:495: UserWarning: Using a range string is deprecated. Use ws[range_string]
warn("Using a range string is deprecated. Use ws[range_string]")
Traceback (most recent call last):
File "/home/kylefelipe/Dropbox/projetos pycharm/Word/manipular_planilha.py", line 17, in
folhas.min_row + 1, folhas.max_row)):
File "/home/kylefelipe/Dropbox/notifica_tax/notificar_tax/lib/python3.6/site-packages/openpyxl/worksheet/worksheet.py", line 496, in iter_rows
min_col, min_row, max_col, max_row = range_boundaries(range_string.upper())
File "/home/kylefelipe/Dropbox/notifica_tax/notificar_tax/lib/python3.6/site-packages/openpyxl/utils/cell.py", line 129, in range_boundaries
raise ValueError("{0} is not a valid coordinate or range")
ValueError: {0} is not a valid coordinate or range'