Login page using google sheets

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

Probably easier to send from the app as a parameter....

image

The first replicates the google form timestamp, then second is in millis which is more flexible in terms of use....

THAT IS GOOD IDEA,

  • if NAME,AGE,SERIALN are not column A,B,C BUT A ,G,K .. how can i put my data under A,G,K instead of A,B,C columns?
  • i would not expect more help, u already did a lot.. just in case you feel like
    thanks for all the past help

Something like this:

sh1.appendRow([e.parameter.name,"","","","","",e.parameter.age,"","","",e.parameter.serialn]);

I HAVE A PERFECT COMPLETE PROJECT NOW BECAUSE YOU HELPED ME .. saving me months of reading into minutes .. Really appreciated SIR, i have no more Q, both my arduino and MIT A2 sending to the secured restricted sheet the way i want after following your help. Jesus blesses you

i learned from you this one too (cell phone sends time stamp...etc) , thank you ,

  • as well found this script (as you know with your eyes closed :slight_smile: ) .. posting as SHARING IS CARING PRINCIPAL

function onEdit(e) {
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(e.range.getRow(), 4).setValue(new Date()).setNumberFormat("MM/dd/yyyy hh:mm:ss" );
}

HELLO,
one more Q please:
before i restrict the sheet , i used to call certin cell value by url like: https://docs.google.com/spreadsheets/d/xxxx sheeet id xxxxxxxxxxx//export?format=pdf&size=a7&gridlines=true&gid=1683005714&range=G2:G4

  • now the shhet is restricted ; so seems i need to run script to get this G2-4 values and call that url of that script.. found google example as:
    var cellA1 = SpreadsheetApp.getActiveSheet().getRange('G2:G4').getValue(); but do not know how to put in a full script; like function name...etc and what will be the url to call and execute that new script of getting G2:G4 ; like after http://docs.google.com/xxxxxxxxxxxxxxxxx etc till/exec? then what to add after exec?
    would you please help me one more time here

Do you really want to download a pdf of three cells, or do you simply want to return the cell values to your app?

Hello,
no need to download .. this was the only way for my iphone to read those 3 cells .. so using /export?format=pdf&size=a7&gridlines=true&gid=1683005714&range=G2:G4 >> it open pdf in the firefox browser (so no download .. i just can see the vsalues of the 3 cells this way .) , if you know better way for the iphone to see those values of the 3 cells please let me know ..

  • so now after restricting the document of the three sheets using the script to write to it .. now which script can i use to display those G2:G4 cells and what will be the new url add on ? like after /exec? .. what should i add to display those values ? .. please if you can help this way or another to display restricted sheet values on iphone . thanks a millions

Here are the basics. Suggest you do not restrict yourself to just that range, then you can return other ranges as well..

Assumes spreadsheet and sheet are set to ss and sh respectively

var rng = e.parameter.RANGE;

var data = JSON.stringify(sh.getRange(rng).getValues());

return ContentService.createTextOutput(data);

in the blocks

in the textbox, for example:

G2:G4

I CAN'T THANK YOU ENOUGH GENIUS TIM.
i can't believe it is working like a charm !

  • i searched alot and could not find what you did to me .. what key words i need to google for DEEP learning ? .. just java or google sheet script or ...etc
  • also i never found a way to know how to manipulate the url like /exec?/export or ?range or...etc where to find that to study it ? ..
  • last Q the awesome script you wrote works great on the iphone when i call the url or the script link/?RANGE=G2:G4 but output like [232],[844] in small font , how can i control the output size/color of the font to be readable more easily .... i tried thinks like this &size=a7&gridlines=true with the url but it doen't go through .

It is google apps script, which is mostly just pure javascript (not java)

Increase the font size of the label in your app ?

Set the label to HTMLContent and use font color tags to change the colour

THNAKS ,
this is for android, but i want those values on iphone (if i understand correctly, i can not mitapp inv2 on iphone yet "correct me ; unless developer account at 99$...etc") , so i use url link like >> https://script.google.com/macros/s/xxxxxxxxxxxxxxxx ID XXXXXXXXXXX/exec?RANGE=G2:H2 BUT i am getting this small font on the iphone browser [[34,245]] ? what do you think ?

Why are you returning this value in the browser ?

Do as I showed and return it in your app...

I return in browser because i can not run the app on iphone .. am i right ? AI2 only can have apk for android and only companion (temporary) on ihpne, unless i get developper account 100$ with apple.. am i understanding that right ? so my only way to get those values on iphone is by the url on a browser? right ?

You are correct, it is not yet possible to compile an app for the iphone

Then we are not using AppInventor, your enquiries are outside the remit of this community.

You would need to return an html page in the apps script that is displayed and hopefully rendered correctly in a browser, using css to size and colur the text returned.

e.g.

return ContentService.createTextOutput('data:text/html, <html><body><p style="color:red;font-size:40px">' + data + '</p></body</html>')

COMPLETELY AGREE WITH YOU .

  • i am using MIT AI2 for all data entry , received from its camera QR and arduino esp32.. finally get data on android as label box by mit app .. so far so good. had some need to do the same on iphone .. was impossible by mit so i used url just to retrieve those data on iphone . i am very happy by results you gave me (secure the sheet and retrieve the data at android mit app and iphone url) . wish you all the best. thanks Sir forever