0
I am using python for automation, where I need to set a series of information in the spreadsheet.
I understand I need 2 for
, one to traverse a row and the other the column, I need to define a limit because each row and column has to go to j
. I wanted to know how the information in the spreadsheet within these 2 for
. I know how to set but not inside a for
.
I’m using library openpyxl
import
load_workbook
The code is like this:
max_linha = sheet.max_row
max_coluna = sheet.max_column
for i in range(1,max_coluna + 1)
for j in range(1,max_linha + 1)
For setar I do so:
sheet[A1] = "Ok"
It would be something like?
sheet["A"][i][j] = variavel
This is not a question of the language. You should search the documentation of the libraries you are using. If you still have a problem, you need to offer a short but complete script, from the Imports, for someone to test and suggest repair.
– epx
Wouldn’t it be better to use the pandas library? It works much better with CSV’s files (if applicable). It creates dataframes that you can access all the rows/columns with for, or through keys, or break the dataframe in determinava row/column with the functions "Loc" and "iloc". Your question is very superficial, post a more complete code to better understand the problem or be possible to test it.
– Pedro Costa
Thanks pedro, I gave a researched think it will be better to use pandas same, mainly because of the issue of dataframes. I will search how to do if I have any questions back here. thanks...
– Marcos Reis