Hello everyone, I am pulling data from google sheets. I'm about to complete the application but I have a problem, if the email and password match, I want to login by redirecting but I couldn't.
to where ?
Where is the problem ?
You do not show your google sheet data or your script, or confirm that the script is working correctly ?
that is, I think the data and javascript codes are correct because it pulls all the data, but if the password and email entered in my application match those in this table, I want to redirect
OK, you need to see if this section of your code is performing correctly using Do It with the companion app, and by setting a label for the output of index 6.
actually I'm having trouble pulling the data, it shows all the data, I just want to see if the email and password information I have belongs to the data in the same line..
What is being returned in your responseContent?
Why don't you just call back the data you need, by supplying your script (after making some changes) with the userID ?
Or you can use gviz query if your sheet is anyone with the link
If I were doing this with the Spreadsheet blocks, I would add an extra column to the sheet, containing userid/password (a triple text join.)
Then I could submit a filtered Get Row based on that column value.
I should get back 0 rows if the userID and password don't match,
one row if okay.
how can I do that?
How can I compare the data at hand with the uid data in that row
from this data:
If using the Spreadsheet component, something like this:
If using a gviz query (with the web component), something like this:
https://docs.google.com/spreadsheets/d/1IdpGILd7Nii8nq5yb2Qu3kVFyyL50eo5la2xbDN1Cok/gviz/tq?tqx=out:csv&tq=SELECT * WHERE D = 'lhatchard3@slashdot.org'
I can't use this component because I can't run it
You mean the Spreadsheet component ? If to difficult for you to set up, then use a gviz query with the web component, or amend your google apps script to run the query.
Herewith an example piece of code:
// outputs results from SQL query of all data
else if ( fn == 'QUERY' ) {
var rgq = sh.getName() + "!" + sh.getDataRange().getA1Notation();
var sql = e.parameter.SQL;
var qry = '=query(' + rgq + ';\"' + sql + '\";1)';
var ts = ss.insertSheet();
var setQuery = ts.getRange(1,1).setFormula(qry);
var getResult = ts.getDataRange().getValues();
ss.deleteSheet(ts);
return ContentService.createTextOutput(JSON.stringify(getResult));
}
you need to send as parameters:
fn = QUERY
and (for example)
SQL = SELECT * WHERE B = 'name'
^^^
needs to be uriEncoded in the app before sending
yes, there seems to be a problem with this component, I tried everything, I created the structures you sent, but it always returns an error message.
I'm also trying the query you gave right away. Thank you very much.
unfortunately that didn't work either.