data = [1,2,4,5].map(d => {
let sheet = workbook.sheet(d)
return sheet.map(row => {
let column_keys = Object.keys(h1)
let contest = row["B"]
let choice = row["D"]
return column_keys.map((col, i) => ({
"date": new Date(h1[col].split("- ").pop() + " 2022"),
"jurisdiction": workbook.sheetNames[d],
"contest": contest,
"choice": choice,
"factor": h2[col],
"type": h3[col],
"value": row[col] == "N/A" ? undefined : row[col],
}))
})})
.flat(Infinity)
.filter(d => d.contest)
.sort((a,b) => d3.ascending(a.date, b.date))