Thanks to everybody.
I've got a Google spreadsheet containing 7 sheets. I'm trying to move data in the last sheet from cells A1:D1 to a new row appended to the bottom of the same sheet.
Here is the snippet of code I'm using:
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[6];
var src = sheet.getRange('PaycheckHistory!A1:D1').getValues();
sheet.appendRow([src]);
After I run the code, on the tab "PaycheckHistory", in a new row appended to the bottom of the sheet, I get the following: "[Ljava.lang.Object;@3e0d05f9"
Can anybody tell me (a) What is this error, (b) What does this mean, and (c) How do I fix this or perform my goal, which is to "move data in the last sheet from cells A1:D1 to a new row appended to the bottom of the same sheet."
Thanks, all!
6/22/18 IDK if this will help, but cannot find an "update this question" button on the screen showing my original post. I DID, however, find an "edit" button, and I'm using that now.
Here's the complete code that I'm using: (apologies if the code is not formatted properly)
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Tasks')
.addItem('createCopy','createCopy')
.addToUi();
}
function createCopy() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[6];
var src = sheet.getRange('PaycheckHistory!A1:D1').getValues();
sheet.appendRow(src[0]);
SpreadsheetApp.flush();
var myValue =
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange("O58").getValue(); var destinationFolder = DriveApp.getFolderById("1errc7- 2sM**********ZPKJIxjZOTRWo");
DriveApp.getFileById(SpreadsheetApp.getActiveSpreadsheet().getId()).makeCopy(myValue,destinationFolder);
}
Here's the problem I'm getting: The first part of the function (ABOVE "SpreadsheetApp.flush();") moves data on sheet 6 of the spreadsheet.The next part of the function (BELOW "SpreadsheetApp.flush();") copies the entire spreadsheet, puts the copy in a specified folder, and renames the copy.
I want this function to do more things on other tabs/sheets in the spreadsheet file. I can write additional code to do this, but when I add the new code to the existing function above, the new code does nothing. Simply using "SpreadsheetApp.flush();" does not work.