Script: Text box

To add a text box to your script

Text box 

var ui = SpreadsheetApp.getUi(); // Same variations.

var result = ui.prompt(
'Enter name:',
var button = result.getSelectedButton();
var name= result.getResponseText();

Evaluating text box input

if (button == ui.Button.OK) {
// User clicked "OK".
ui.alert('Input received);
} else if (button == ui.Button.CANCEL) {
// User clicked "Cancel".
ui.alert('Clicked cancel');
} else if (button == ui.Button.CLOSE) {
// User clicked X in the title bar.
ui.alert('Closed the dialog.');