Airtable Scripting App - Copying a field to another within the same table for 10,000+ entries

I am attempting to transfer data from one field to another within a table that contains more than 10,000 records using the Scripting App, processing in batches of 50 records at a time. However, I am facing an issue with my code, as it only transfers the value from the first record. When I eliminate the await statement, it processes 15 records but then halts. Here is my code snippet:

let myTable = base.getTable('Vendors');
let myView = myTable.getView('Main View');
let myQuery = await myView.selectRecordsAsync();
let allRecords = myQuery.records;

processRecordBatches(allRecords);

async function processRecordBatches(allRecords) {
  let index = 0;
  while (index < allRecords.length) {
    const batch = allRecords.slice(index, index + 50);
    for (let entry of batch) {
      let valueToCopy = entry.getCellValue('Merchant Name');
      await myTable.updateRecordAsync(entry.id, { 'ImageBase64': valueToCopy });
    }
    index += 50;
  }
}

Can anyone guide me on what I might be doing incorrectly here?

hey FlyingStar! It looks like your issue might be due to hitting API limits when making too many update calls at once. Try implementing delays using setTimeout or await more strategically within your loop. This can help avoid rate limiting by spacing out requests just a bit. Hope it helps!