Login page using google sheets

Hi, I already tried this to my project but I still don't know how to prevent adding same username/email. Please help.

It would really help if you provided a screenshot of your relevant blocks including Do it results so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

This is how to do it but the registration, separated from the login

Hello Tim, i am trying for weeks now w/o success. would you please help if how have time please?

  • Mit is reading/writing to googlesheet without a prob except i had to share the link to googlesheet as ANYONE WITH THE URL LINK... my question is: how to put googlesheet share as restricted to evryone EXCEPT my android mit app ? btw i have 3 tabs inside one sheet .. would you please tell me how to secure my G.Sheet so not anyone with the link can delete or modify it but only mit app can access to write and read from G.Sheet ? thanks a million

Are you using a Google apps script?

Here's my sharing setup for a Sheets demo:

The viewing for any one was added by me for demo purposes, and is not necessary for the AI2 Spreadsheet component.

hello TIM,
no i am not using script .. i use url to write to the sheet like:
https://docs.google.com/forms/d/e/xxxxxxxxxxxxxxxxxx/formResponse?&submit=Submit?usp=pp_url&entry.1869488340=mydata

  • i am afraid anyone get access to it, i need to put it back to restricted access but let mit only to edit it.

should i use script ? which? thanks a lot

You will need a Google apps script if you want to read and write from a restricted Google sheet. Or use the native spreadsheet component.

for my and everyone benefit: if that is correct the please approve :slight_smile: .. i mean i should deploy this script and restrict the file ? .. what do you think of this script ?

function doGet(e) {

 

  var ss = SpreadsheetApp.openById("xxxxxxxxxxxxxxxxxxxxxxxxx");

  var sh = ss.getSheetByName("Sheet1");

  var name = e.parameter.name ;

  var age = e.parameter.age ;

  sh.appendRow([name,age]);




  var sss = SpreadsheetApp.openById("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

  var shs = sss.getSheetByName("Sheet3");

  var serialn = e.parameter.serialn ;

  var skl = e.parameter.skl ;



  shs.appendRow([skl,serialn]);

  return ContentService.createTextOutput("Success: " + name + ", " + serialn + " added");
 
   
}

thanks for sharing .. does it mean anyone will the link will be able to view but not to write into or delete ? .. if yes then the only solution to have it restricted is to use script ? .. did i get that all right ? .. please correct me
thank you so much

Is the spreadsheet the same for Sheet1 and Sheet3 ? If so, the script could be improved, also what is that script for, signing up a user ?

The Spreadsheet component can be used with a restricted google sheet, available only to the owner outside of the AI2 app

Dear Tim,
Yes two different sheets within one file but I have no have script writing experience so I tried to modify what I found online from one sheet to two … so I have one google file with two tabs on the down bar (sheet 1, sheet2, sheet3 ) I need to write in some cells of sheet one and 3 .. would you please optimize it .. then should I deploy and get the url of the script then restrict the sheet from sharing and use that script url to read/write to the sheet ? .. am I understanding this right?

Thank you so much

Try something like this: ( I have not tested it...)

function doGet(e) {

  var ss = SpreadsheetApp.openById("Spreadsheet ID here");
  var sh1 = ss.getSheetByName("Sheet1");
  var sh3 = sss.getSheetByName("Sheet3");

  // sets data to rows on two different sheets
  sh1.appendRow([e.parameter.name,e.parameter.age]);
  sh3.appendRow([e.parameter.skl,e.parameter.serialn]);
  
  // ensures spreadsheet operations completed
  SpreadsheetApp.flush();
  
  // tests that the data has been written before reporting success...
  var lr1 = sh1.getLastRow();
  var rng1 = sh1.getRange('A' + lr1).getValue();
  var lr2 = sh3.getLastRow();
  var rng2 = sh3.getRange('B' + lr2).getValue();  
  if (rng1 == e.parameter.name && rng2 == e.parameter.serialn) {
  return ContentService.createTextOutput("Success: " + e.parameter.name + ", " + e.parameter.serialn + " added");
  } else {
  return ContentService.createTextOutput("Oops, something went wrong");
  }
}

you are better than ChatGPT

SORRY ONE MORE.. DEPLOYING IT SAYS : Syntax error: SyntaxError: Unexpected identifier 'getValue' line: 16 file: Code.gs

ITS HERE > var rng1 = sh1.getRange('A' + lr1)getValue();
WOULD YOU PLEASE FIX IT, SOUND A SYNTAX ISSUE?

one more .. instead of my variable called (name,age,skl,serialn) .>>> i want to use NAME and CELL NUMBER .; seems compiler did not like the space in (CELL NUMBER) nor capital (NAME) ; any work around ? thanks a lot

There is a . (dot/period) missing before each of the getValue(). Sorry. Have updated my script example.

That ( dot . ) fixed it ...>
last is>> ,e.parameter.CELL NUMBER, ...>> how can i leave a space between CELL AND NUMBER ?
BE BLESSED

You probably can't. Use cellNumber or if you must CELLNUMBER

What is this "CELL NUMBER" ? Is it meant to come from the spreadsheet, or is it a number you provide from the app ?

aside from two words column header (not big issue) , my issue is i used to get time stamp once my cell send data to google sheet , now i lost this ! .. google suggested >> function onEdit(e){
const sh = e.source.getActiveSheet();
sh.getRange ('d' + e.range.rowStart)
.setValue (new Date())
.setNumberFormat ('dd/MM/yyyy HH:MM:SS');
}

but it did no difference .. would you please she me some light here; how to get the time stamp back ?
thank you so much