You can use the CLI action step in conjunction with the the Download step to perform advanced validations of Excel files such as number of sheets and content.

Example code:

const { SheetNames, Sheets } = XLSX.read(fileBuffer);

if (SheetNames.length !== parseInt(expectedNumOfSheets)) {
  throw new Error(`Number of ssheets doesn't match ${SheetNames.length}`);
}

const sheet = Sheets[SheetNames[0]];
const sheetAsJson = XLSX.utils.make_json(sheet);
if (sheetAsJson.length !== 4 || sheetAsJson[0].Name !== "Rajeev Singh") {
  throw new Error(`Failed to validate sheet 1`);
}
console.log("sheet", JSON.stringify(sheetAsJson));

Parameters - Packages and JavaScript used in this example:

  1. name: XLSX, type: Package, value: xlsx@0.14.1
  2. name: expectedNumOfSheets, type: JavaScript, value: '2'

see screenshot:

Did this answer your question?