-
Notifications
You must be signed in to change notification settings - Fork 1
/
TabulatorCode.gs
28 lines (24 loc) · 986 Bytes
/
TabulatorCode.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Main code to get the data
function getData3() {
const theSheet = new MySheet({ sheetId: nsProps.sheetID, sheetName: nsProps.dataSheet });
let emailIndex = theSheet.headers.indexOf(nsProps.emailHeader);
//get the current user (which is LOWERCASE) and filter on the email index TO LOWERCASE
let crntUser = nsProps.currentUser();
let userDataAll = theSheet.dataFilter({ filterColumnIndex: emailIndex, filterCondition: crntUser })
if (userDataAll.length > 0) {
//get just the columns to display
let userData = theSheet.columnsToKeep({data:userDataAll,colIndxsKeep:nsProps.colsKeep})
let userHeaders = theSheet.columnsToKeep({data:theSheet.headers,colIndxsKeep:nsProps.colsKeep})
let theKey = userHeaders.indexOf("key");
userData.unshift(userHeaders)
let dtJSON = makeData({ values: userData })
//return the JSON data
return dtJSON.data;
} else {
return "OOPS";
}
}
const tester = ()=>{
let rslt = getData3()
console.log(rslt)
}