Coding In Google Sheets to Create an HTML

Solution for Coding In Google Sheets to Create an HTML
is Given Below:

Basically what I’m trying to do is have google sheets take the user input and plug it into a website template that will then be used to scrape information from that website.

Example would be:
User selects “candy” from cell A2
I would then like to have another cell develop the website: www.something.com/candy/secondpart

This should work. You’ll need to create some sort of trigger to make this happen, but this will return the HTML content.

function pullDateFromWebsiteBasedOnCell() {
  const theSS = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); //or specify
  const theFirstPart = "https://www.something.com/";
  const theLastpart = "/secondPart/";
  var theMiddlepart = theSS.getRange("A2").getValue();
    var theURL = theFirstPart+theMiddlepart+theLastpart;
    var response = UrlFetchApp.fetch(theURL);
    var theHTMLtext = response.getContentText(); //gets content as HTML blob.
    Logger.log(theHTMLtext);
    return theHTMLtext;
}