Sending a Picture and location data to googlesheet - using a solution by TimAI2 found on old forum - a follow up

Hi,

I am using this solution by TimAi2 https://groups.google.com/forum/#!topic/mitappinventortest/liWppNXqHXM and thanks to Tim’s help finally got it working.

I now need to capture two additional user typed text fields. I have tried various options but am very much a newbie on this.

Grateful if someone can show how to do it.
The current solution is giving me date,location, time in the googlesheet and a link to the picture. I need to add name and comment .

Secondly - If on first running - it cannot get a location - it gives an error message and does not send anything. On subsequent clicks, if it cannot get a location, it just sends the previous one again.

Is there a way to clear the previous location? It would be better if it just sent an error message to googlesheet if cannot get location (together with picture, time etc).

I am running a charity and want to use it as a way of monitoring IN/OUT time and location for field workers. Otherwise they just pretend to show up and stay at home!

For the location sensor, try disabling / enabling the sensor, that “should” ask it to find the location again (another 30 second wait).

For the additional data, you just need to add these items to you postText block:

&name=
"nameVariable"
&comment=
"commentVariable"

and your script: (something like)

var viewurl = "https://drive.google.com/uc?export=view&id=" + imageID;
    
var username = e.parameters.name[0];   //add this
var comment = e.parameters.comment[0];   //add this
  
var ss = SpreadsheetApp.getActive();
var sh = ss.getSheets()[0]; 
sh.appendRow([lat,lon,add,imageID,name,viewurl,username,comment]);  //add these last two elements