How to run a code through all rows of a table?

Dear All,

I have a table (DatasetCountry) connected to the collection (CollectionCountry).

This collection is updated thanks to an Excel sheet import. That means an empty cell in Excel is displayed with the value NULL in my Wix table (IMAGE 1)

I typed the following code to remove the mention NULL.

$w.onReady( function () {
$w(“#DatasetCountry”).onReady( () => {
let itemData = $w(“#DatasetCountry”).getCurrentItem();
if (itemData.formalName === null ) {$w(“#DatasetCountry”).setFieldValues({“formalName”: “”,});}
});
});

This code works well but only for the first row (IMAGE 2)

How to run this code for all rows of the table?

Thank you for your help.
Best regards,
Domivax

IMAGE 1

IMAGE 2

Why not just add a simple - to all the blank cells in Excel so that when you import it into Wix, every cell has a value and you don’t have the issue of having the null message, instead the empty cells will simply display as - on your table.