Yes, it is possible to write a script to make a copy of the table every day.
In short, you will have to make a copy of the imported table and paste it into a new Sheet. ImportHTML a gets updated every time you open/access the spreadsheet. So only way to store table is to make a copy and paste it into a new sheet.
Here is code that does just that:
function getImportData()
{
var ss = SpreadsheetApp.getActive()
var sheet =ss.getSheetByName("ImportSheet")
if (sheet == null)
{
sheet = ss.insertSheet("ImportSheet")
sheet.getRange(1,1).setValue( "=IMPORTHTML(\"https://en.wikipedia.org/wiki/Lubbock,_Texas\",\"table\",5)")
}
var dataRange = sheet.getDataRange()
//waitforLoading waits for the function importHTML to finish loading the table, only a problem if table takes a while to load
//for more discussion on this visit : http://stackoverflow.com/questions/12711072/how-to-pause-app-scripts-until-spreadsheet-finishes-calculation
var wait = waitForLoading(dataRange,sheet, 10)
var logSheet = ss.getSheetByName("ImportLogSheet")
if (logSheet == null)
{
logSheet = ss.insertSheet("ImportLogSheet")
}
var timeStampRow = []
timeStampRow[0] = new Date()
if(wait)
{
logSheet.appendRow(timeStampRow)
var lastRow = logSheet.getLastRow() + 1
var destinationRange = logSheet.getRange(lastRow,1)
dataRange.copyTo(destinationRange, {contentsOnly:true})
}
else {
timeStampRow[1] = "Scripted timeout waiting for the table to Load "
logSheet.appendRow(timeStampRow)
}
}
function waitForLoading(dataRange, sheet, maxWaitTimeInSec)
{
// This function is only required if it takes a while for the importHTML to load your data!
// if not you can skip this function
// Function looks to see if the value of the
for(i = 0; i< maxWaitTimeInSec ; i++)
{
var value = dataRange.getCell(1,1).getValue()
if(value.search("Loading") !== -1) {
Utilities.sleep(1000);
dataRange = sheet.getDataRange()
} else {
return true
}
}
return false
}
Edit: Forgot to mention about setting up triggers. You can setup any function to be triggered using time-driven triggers. Details on how to set it up is given here: https://developers.google.com/apps-script/guides/triggers/installable#managing_triggers_manually