'Javascript-Google App Script. I'm getting TypeError: Cannot read property 'map' of undefined
I have this code in Google Docs, I'm trying to create a registry sheet with data from the other sheets, but I keep getting TypeError: Cannot read property 'map' of undefined. What could be the problem?
function processData(sheetData){
var transpose = m => m[0].map((x,i) => m.map(x => x[i]))
var data = sheetData.map(x=>x.slice(0,lastRow))
data[1] = data[1].map((l => (v, i) => l = v === '' ? l : v)());
var transposedData = transpose(data)
transposedData[0] = transposedData[0].map((l => (v, i) => l = v === '' ? l : v)());
data = transpose(transposedData)
var dataFilterProjects = data.filter(row=> row.slice(2,).map(j=> (j!='') ? 1 : 0).reduce((a, b) => a + b, 0)!=0)
var dataFilterDays = transpose(transpose(dataFilterProjects).filter(row=> row.slice(4,).map(j=> (j!='') ? 1 : 0).reduce((a, b) => a + b, 0)!=0))
var dataTotalFilter = dataFilterDays.filter(row=> row[1]!= 'Total')
return dataTotalFilter
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
