Post user data to respective google sheets in the spreadsheet

yah.. I have it :+1:

Here I found the error to be those e.parameter.action values - 'register' & 'login to be in quotes.. now the function is working properly by creating new sheets & accessing them..

But, I have a problem in setting the accessed sheet to be the active sheet in the script. As I have mentioned before, I have other functions like 'Adding User', 'Obtaining User Data and Plotting them' to be executed within the logged in sheet. Passing this ss.setActiveSheet(sheet) in the 'login action' block doesn't solve it either.

You shouldn't or don't want to do that . The username defines the sheet to use, set this as a parameter in your blocks and script to interact with the correct sheet.

I have obtained the username as variable 'user' in the doPost() function. I am not able to pass this local variable in the other functions.
Here I have attached my script. so pls can you look into it?
AppsScript.txt (1.7 KB)
I am doing the registering and loging functions in one screen and the adding user data in the next of the app inventor.. does it affect the calling of the function in the script?

Try this script

AppsScript.txt (1.7 KB)

I have converted your local variables to global variables

Thank you, Tim. With the solution for accessing the user's sheet in place, I've encountered another challenge: encountering the error
'TypeError: Date.toDateString is not a function' . My date is in the format of 'dd-mm-yyyy'.

Try this in your script:

I would always recommend you set your dates to yyyy-MM-dd format, you can then sort these by date!

1 Like