Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function doGet(e){
- return Authentication(e);
- }
- function doPost(e){
- return Authentication (e);
- }
- function Authentication(e){
- if (e.parameter.func=="Create") {
- var ss = SpreadsheetApp.openById(e.parameter.ID);
- var sh = ss.getSheetByName(e.parameter.SH);
- var rg = sh.getName() + "!" + sh.getDataRange().getA1Notation();
- var email= e.parameter.email;
- var sql = '"Select B where B=\'' +email+'\'"';
- var qry = 'IFERROR(query('+rg + ','+ sql +'),""';
- var ts = ss.insertSheet();
- var setQuery = ts.getRange(1,1).setFormula(qry);
- var getreslut = ts.getDataRange().getValues();
- ss.deleteSheet(ts);
- if (getreslut==""){
- var dara = [e.parameter.tlid, e.parameter.email, e.parameter.password, e.parameter.phone];
- sh.appendRow(dara);
- return ContentService.createTextOutput("getreslut");}
- }
- //-------------------------------------------------------------------
- //needd diffrent SheetID to be passed in the paramenter(data sheet)
- if (e.parameter.func=="Login"){
- var ss = SpreadsheetApp.openById(e.parameter.ID);
- var sh = ss.getSheetByName(e.parameter.SH);
- var email = e.parameter.email;
- var password = e.parameter.password;
- var rg = sh.getName() + "!" + sh.getDataRange().getA1Notation();
- var sql = '"Select A,B,C,D where B=\''+email+'\'" ';
- var qry = '=IFERROR(query('+ rg +','+ sql +'),"")'; //formula
- var ts = ss.insertSheet();
- var setQuery = ts.getRange(1,1).setFormula(qry);
- var getreslut = ts.getDataRange().getValues();
- var getPWD = ts.getRange(1,3).getValues();
- var getemail = ts.getDataRange(1,2).getValues();
- ss.deleteSheet(ts);
- if (getreslut!=""){
- if(getPWD==password){return ContentService.createTextOutput(getemail);}
- else { return ContentService.createTextOutput("ERPWD");}
- }
- else {return ContentService.createTextOutput(getreslut)}
- }
- }
- //if (e.parameter.func=="List"){
- function test(){
- var ss = SpreadsheetApp.openById("1I4OmVach96qOG_RU0OvEkcW8sFDUF_wtbrZuvYR1F-g");
- var sh = ss.getSheetByName('CONDITIONAL');
- var rg = sh.getDataRange().getValues();
- // var ss = SpreadsheetApp.openById(e.parameter.ID);
- // var sh = ss.getSheetByName(e.parameter.SH);
- // var rg = sh.getRange().getValues();
- var outString= '';
- for(var row = 0; row<rg.length; ++row ){
- outString += rg[row].join('') + '\n';
- Logger.log(outString);
- }
- Logger.log(outString.typeof)
- //return ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);
- }
- function formula(){
- var ss = SpreadsheetApp.openById("1I4OmVach96qOG_RU0OvEkcW8sFDUF_wtbrZuvYR1F-g");
- var sh = ss.getSheetByName()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement