Can someone suggest me a Google Script that will make a button that will get the mail ID of the person and put it into a specified Google sheet.
This would be your script. Create a drawing like a button, via the little 3 dots you can assign it to a script, type: getEmail.
If the user is a gmail user it will append the value to the target sheet. If not then it opens a prompt where someone can enter the email.
function getEmail(){
const ui = SpreadsheetApp.getUi();
const ss = SpreadsheetApp.getActiveSpreadsheet();
const targetSheet = ss.getSheetByName("targetsheet"); // change to desire
const userMail = Session.getActiveUser().getEmail();
if (userMail == null){
targetSheet.appendRow(ui.prompt("Enter email").getResponseText());
} else {
targetSheet.appendRow([userMail]);
}
}