I have a table of 5 rows and 5 columns. For each column I have a name, for example: Name, Age, Sex, Weight, Height. And all 5 * 5 cells are filled.
I need the following formatting:
Idade
João - 15
José - 16
Maria - 21
Sexo
João - M
José - M
Maria - F
That is, for each cell information I need you to show me which person is related to this result.
I already ready the title (Age) and the value (16), but I can not link the name to each information, being:
Nome
JOão
JOsé
MAria
Idade
16
15
21
Sexo
M
M
F
I've created a variable that takes the value of the cell (x, y), but prints empty. Here is my code:
for crange in sheet.merged_cells:
rlo, rhi, clo, chi = crange
rranges[(clo,rlo)] = rhi - rlo;
for col_index in range(sheet.ncols):
linhas = iter(range(sheet.nrows));
nome_mol = ""
for row_index in linhas:
if (sheet.cell_value(row_index,col_index) != ''):
valor = sheet.cell_value(row_index,col_index);
if (sheet.cell_value(row_index,col_index) == "NOME"):
nome_mol = sheet.cell_value(row_index,col_index)
print "{} -- {} |{} |".format(nome_mol, valor)