INNER CODE UNIT · TypeScript
generateRow
google-marketing-solutions/feedgen · src/app.ts:211
export function generateRow(headers: string[], row: string[]) {
// Get the 'target output row' index value
const rowIndex = Number(row.pop());
let outputRow: (string | number | boolean)[] = [];
try {
outputRow = optimizeRow(headers, row);
} catch (e) {
const itemIdIndex = headers.indexOf(
String(getConfigSheetValue(CONFIG.userSettings.feed.itemIdColumnName))
);
outputRow[
CONFIG.sheets.generated.cols.status
] = `${Status.FAILED}. Check the 'Full API Response' column for details.`;
outputRow[CONFIG.sheets.generated.cols.id] = String(row[itemIdIndex]);
outputRow[CONFIG.sheets.generated.cols.fullApiResponse] = String(e);
}
SheetsService.getInstance().setValuesInDefinedRange(