Contesto a tú pregunta acerca de cómo recorrer una tabla, entiendo que lo quieres hacer con JavaScript:
function foreach(root, selector, callback) {
if (typeof selector == 'string') {
var all = root.querySelectorAll(selector);
for (var each = 0; each < all.length; each++) {
callback(all[each]);
}
} else {
for (var each = 0; each < selector.length; each++) {
foreach(root, selector[each], callback);
}
}
}
function walk(table) {
var table = document.getElementById(table);
var data = [];
if (table) {
foreach(table, 'tr:not(:first-child)', function(row) {
var record = [];
foreach(row, 'td', function(cell) {
record.push(cell.innerText);
});
data.push(record);
});
}
/* data contiene los datos de la tabla */
console.log(JSON.stringify(data, undefined, 3));
return data;
}
<table id="table">
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
<tr>
<td>1,1</td>
<td>1,2</td>
<td>1,3</td>
</tr>
<tr>
<td>2,1</td>
<td>2,2</td>
<td>2,3</td>
</tr>
<tr>
<td>2,1</td>
<td>2,2</td>
<td>2,3</td>
</tr>
</table>
<button onclick="walk('table')">Recorrer</button>
Espero te sea de ayuda.