I took your first example from #87 and changed 3 things:
I changed what name and name2 were referring to
I changed the .fromSheet parameters to sheets I'd already fetched
I added a .toSheet call
const name = new RefExpr("Email");
const name2 = new RefExpr("Email2");
// Read the data for sheet1
const sales = Table.fromSheet(leftSheet)
// Keep only the name column
.select([{expr: name}]);
// Read the data from sheet2
const customers = Table.fromSheet(rightSheet)
// keep only the "name" column renamed to "name2"
.select([{expr: name, as: "name2"}]);
// Build the list of unique missing names from sales
const missing = sales
// A left join keeps any unmatched rows from the left (probe, sales) side
// by filling in nulls for the right (build, customers) side columns
.equiJoin(customers, {probe: name, build: name2}, {type: 'left'})
// We can then filter it down to the name2 values that are null
.where(new FuncExpr(Expr.isnull, [name2]))
// And remove the duplicates
.groupBy(name)
.toSheet(target)
;
I get the following error when I try to run it:
ReferenceError: Unknown column: Email. Did you mean "email2"?
evaluate @ olapscript.gs:209
(anonymous) @ olapscript.gs:1373
Table.select @ olapscript.gs:1371
testAnother @ Code.gs:198
These just confound me. What could I possibly have changed that would produce such an error? Line 198 is
I took your first example from #87 and changed 3 things:
// Read the data for sheet1 const sales = Table.fromSheet(leftSheet) // Keep only the name column .select([{expr: name}]);
// Read the data from sheet2 const customers = Table.fromSheet(rightSheet) // keep only the "name" column renamed to "name2" .select([{expr: name, as: "name2"}]);
// Build the list of unique missing names from sales const missing = sales // A left join keeps any unmatched rows from the left (probe, sales) side // by filling in nulls for the right (build, customers) side columns .equiJoin(customers, {probe: name, build: name2}, {type: 'left'}) // We can then filter it down to the name2 values that are null .where(new FuncExpr(Expr.isnull, [name2])) // And remove the duplicates .groupBy(name) .toSheet(target) ;
.select([{expr: name, as: "name2"}]);