I am making a photo shooting contest, the competitor should register using a Google registration form, and upload his photo as well. I searched all over the internet to find
To get a direct link to the image in the spreadsheet, use the getID function instead of getUrl and prepend the URL to Gdrive.
Change this:
var targetRange = sheet.getRange(lastRow+1, 1, 1, 4)
.setValues([[ListVal,textVal,Email,img.getUrl()]]);
To this:
var targetRange = sheet.getRange(lastRow+1, 1, 1, 4)
.setValues([[ListVal,textVal,Email,"https://drive.google.com/uc?export=view&id="+img.getId()]]);