The Conversion/DeleteRowsAndParseXLS extension fetches an Excel file from a URL, parses a selected sheet, and returns the data after removing selected rows.
This is useful when your test needs to read spreadsheet data, ignore unwanted rows, and reuse the filtered result as either an array or an HTML table.
Parameters:
-
filerequired, the URL of the Excel file to fetch and parse; -
sheetNameoptional, the sheet name to parse. If this is not provided, the first sheet in the workbook is used; -
toHtmloptional, set this totrueto return the sheet as an HTML table. Set it tofalseto return the sheet as an array; -
rowNumbersToDeleteoptional, a JSON array string containing the row indexes to remove from the returned data, for example[0,2].
Note: Row numbers are zero-based. For example, row 0 is the first row, row 1 is the second row, and so on.
NLP usage
Use the extension in a journey by calling Conversion/DeleteRowsAndParseXLS with the execute command. Pass each value to the matching extension input using as inputName.
Note: The rowNumbersToDelete input is parsed using JSON.parse. Pass it as a JSON array string, for example [0,1]. Use [] when no rows need to be removed.
To parse the first sheet and remove the first row:
execute "Conversion/DeleteRowsAndParseXLS" using "https://example.com/data.xlsx" as file, "" as sheetName, false as toHtml, "[0]" as rowNumbersToDelete returning $parsedDataTo parse a specific sheet and remove multiple rows:
execute "Conversion/DeleteRowsAndParseXLS" using "https://example.com/data.xlsx" as file, "Sheet1" as sheetName, false as toHtml, "[0,2,4]" as rowNumbersToDelete returning $parsedDataTo return the selected sheet as an HTML table:
execute "Conversion/DeleteRowsAndParseXLS" using "https://example.com/data.xlsx" as file, "Sheet1" as sheetName, true as toHtml, "[]" as rowNumbersToDelete returning $htmlTableYou can also use Virtuoso variables to make the same step reusable across different files, sheet names, output formats, or rows to delete:
execute "Conversion/DeleteRowsAndParseXLS" using "$fileUrl" as file, "$sheetName" as sheetName, "$toHtml" as toHtml, "$rowsToDelete" as rowNumbersToDelete returning $parsedDataExample setup using variables before calling the extension:
store value "https://example.com/data.xlsx" in $fileUrl
store value "Sheet1" in $sheetName
store value false in $toHtml
store value "[0,2]" in $rowsToDelete
execute "Conversion/DeleteRowsAndParseXLS" using "$fileUrl" as file, "$sheetName" as sheetName, "$toHtml" as toHtml, "$rowsToDelete" as rowNumbersToDelete returning $parsedDataThe extension returns either a filtered array of sheet rows or an HTML table, depending on the toHtml value.
This extension requires the following resources:
https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.jshttps://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js
The extension should be configured as:
- Run asynchronously: Yes
- Scope: Global
Limitation: Row deletion is applied only to the JSON array output path. When toHtml is true, the current source returns the sheet as HTML before applying the row filter.
Add the extension to your Virtuoso instance
Select the domain that matches your Virtuoso account.
View source
Last updated: 22/05/2026
Resources:
https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.jshttps://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js
async function getAndParseXLS(file, sheetName, toHtml = false, rowsToDelete = []) {
const { data } = await axios.get(file, { responseType: 'blob' });
return new Promise((resolve) => {
const reader = new FileReader();
reader.onload = function () {
const fileData = reader.result;
const wb = XLSX.read(fileData, { type: 'binary' });
const sheet = wb.Sheets[sheetName || wb.SheetNames[0]];
const filterFunc = (_, index) => !rowsToDelete.includes(index);
if (toHtml) {
resolve(XLSX.utils.sheet_to_html(sheet, { blankRows: false }));
} else {
const sheetData = XLSX.utils.sheet_to_json(sheet, {
header: 1,
defval: '',
raw: false, // Retain original formatting
});
const filteredData = sheetData.filter(filterFunc);
resolve(filteredData);
}
};
reader.readAsBinaryString(data);
});
}
const rowsToDelete = JSON.parse(rowNumbersToDelete); // Delete rows (0-based index)
getAndParseXLS(file, sheetName, toHtml, rowsToDelete)
.then(done)
.catch(doneError);
Comments
0 comments
Please sign in to leave a comment.