Want to Archive data Row wise instead of Column wise

114 views
Skip to first unread message

Sayra

unread,
Aug 1, 2022, 6:35:24 AM8/1/22
to Google Apps Script Community
Hey..!!

I am facing an ISSUE. while archive data from the sheet, Script is fetching all the data, but for the second and third time, it starts to archive data in the next columns instead of last / next Rows. which I want to sort out. Please help me out for this, I am sharing the script here.

your revert will help me to create something new..!!!

function pasteClosing() {
  var spreadsheet = SpreadsheetApp.getActive()
  var ar = spreadsheet.getSheetByName("archiveNOW")
  var ss = spreadsheet.getSheetByName("outNOW")
  var lastar = ar.getLastColumn() + 1
  var last = ss.getLastRow() - 1
  var sheetclosing = ss.getRange(1, 1, last, 98)
  var archivesheet = ar.getRange(1, lastar, last, 98)
  archivesheet.setValues(sheetclosing.getValues())
  sheet.appendRow([spreadsheet.getSheetByName("outNOW")])
  spreadsheet.getActiveRangeList().clear();
}

Clark Lind

unread,
Aug 4, 2022, 9:43:38 PM8/4/22
to Google Apps Script Community
You may have to share your sheet. Some of this doesn't make sense.. like, where is "sheet" defined? (second to last line), and you are trying to append a tab as a row... 
Reply all
Reply to author
Forward
0 new messages