data = {
const sheetRows =
workbook.sheet(0, {headers: true});
const table = aq
.from(sheetRows);
let mostRecentByEmail = table
.orderby(aq.desc('Date'))
.groupby({
email: d => aq.op.lower(d.Email)
})
.rollup({
date: aq.op.max('Date'),
response_count: aq.op.count()
});
return table
.derive({
lower_email: d => aq.op.lower(d.Email)
})
.join(
mostRecentByEmail,
[['Date', 'lower_email'], ['date', 'email']]
)
.select(aq.not('lower_email', 'date'))
}