I am pulling in data using an XML feed - this feed gets refreshed daily. I am trying to write a script to automatically copy and paste values of two cells from Sheet1 into the last empty row of Sheet2. Ideally, I'd like to have the two values be pasted in cells A1 and B1, and then A2 and B2, etc on every refresh. I have a script that can copy/paste one cell into the new sheet, but am having trouble getting both to copy over (I don't think I can use a range because the cells are not next to each other).
Here is what works for one cell:
function copydata() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet1 = ss.getSheetByName("Sheet1");
var sheet2 = ss.getSheetByName("Sheet2");
sheet1.getRange("A60").copyTo(Sheet2.getRange(Sheet2.getLastRow()+1,1,1,1), {contentsOnly:true});
}
But when I combine this with another script, it still only copyies one cell. Here is what I've tried:
function copydata() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet1 = ss.getSheetByName("Sheet1");
var sheet2 = ss.getSheetByName("Sheet2");
sheet1.getRange("A60").copyTo(sheet2.getRange(sheet2.getLastRow()+1,1,1,1), >{contentsOnly:true});
function copydata() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet1 = ss.getSheetByName("Sheet1");
var sheet2 = ss.getSheetByName("Sheet2");
sheet1.getRange("A114").copyTo(sheet2.getRange(sheet2.getLastRow()+1,2,1,1),
{contentsOnly:true});
}
}