So essentially, I wanted to create a script that takes the data from a specific range on one sheet, and push it over to a master sheet, or as I've called it, "Perpetual". New tabs are created daily, and the specified range on these new tabs would need to be pushed over as well, when prompted. When I try to use the script, everyone works, except when the data is being pasted on the "Perpetual" page, the lines are pasting many rows apart, instead of pasting in the last empty row. I am extremely new to coding, and definitely need some pointers as to where I messed up.
function onOpen(e) {
var ui = SpreadsheetApp.getUi();
// Or DocumentApp or FormApp.
ui.createMenu('Push to Perpetual')
.addItem('Push to Perpetual', 'Macro')
.addToUi();
}
function Macro() {
var s = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Extraction Log Perpetual")
var s2 = SpreadsheetApp.getActiveSheet()
var a=s.getLastRow()+1
s2.getRange(3, 21, 5, 13).copyTo(s.getRange(a,1),SpreadsheetApp.CopyPasteType.PASTE_VALUES, false)
};
Please login or Register to submit your answer