0
votes

I have two sheets in a spreadsheet... Sheet 1 ("Updating") imports an HTML table from a website (The website keeps a list of names in a table and resets every day at midnight) I want to keep a running list of the names even after they clear at midnight and start with new names.

Sheet 2 ("Static") takes the names and performs some tasks on them.

How can I get the values from Updating!A2:A to display in Static!A2:A and keep a running log without them being direct references where when Sheet 1 resets, Sheet 2 changes

Example:

Yesterday, Sheet1 had the following names:

  • John
  • Paul
  • Frank
  • Kyle

Today, Sheet1 had the following names:

  • Terry
  • Josh
  • Cory
  • Jerry

I want Sheet2 to have the following even after the yesterday's names go away on Sheet1:

  • John
  • Paul
  • Frank
  • Kyle
  • Terry
  • Josh
  • Cory
  • Jerry

This is what I have:

function onEdit(e)
{
  var row = e.range.getRow();
  var col = e.range.getColumn();

  if(col == 1 && row >1 && ss.source.getActiveSheet().getName() == "Updating")
  {
     e.source.getActiveSheet().getRange(row,14).setValue();//Somewhere in here i need to specify what data I'm setting
  }
}
1
Could you please share a sample of your sheet so that the issue you are experiencing is more clear? - Mateo Randwolf
Try the following: change the row in ``` e.source.getActiveSheet().getRange(row,14).setValue();``` for SpreadsheetApp.getSheetByName('static sheet').getLastRow()+1``` and tell me how that goes. - Mateo Randwolf

1 Answers

0
votes

I think this what you want. I'm sure about what column you want it in.

function onEdit(e) {
  if(e.range.columnStart==1 && e.range.rowStart>1 && e.range.getSheet().getName()=="Updating") {
    e.source.getActiveSheet().getRange(e.range.rowStart,14).setValue(e.value);
    var sh=source.getSheetByName('Static');
    sh.getRange(sh.getLastRow()+1,14).setValue(e.value);
  }
}