Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Loop though Cells to paste the values for the specific column

$
0
0

I have a Google Sheet that users need to submit values weekly.Once they submit using a button, it should do the following:

  1. Copy the values on the submit sheet to the total sheet of that client name for that week. (This example is week 6) (Green cells)
  2. Update the submit sheet to show the next week's number. (Yellow cell)
  3. Clear the contents of the green cells on the submit sheet for the client to prepare the sheet with next weeks data.

Code I have so far:

var weekValue =   spreadsheet.getRange('C5').getValue();spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Swiss Submit'), true);spreadsheet.getRange('D7:D8').activate();spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Swiss Total'), true);spreadsheet.getRange('\'Swiss Submit\'!D7:D8').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Swiss Submit'), true);spreadsheet.getRange('C5').activate();spreadsheet.getCurrentCell().setValue(weekValue + 1);spreadsheet.getRange('D7:D8').activate();spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});

Issues I am facing: How do I get it to paste in the column with the week's number on top?

Link to google sheet: https://docs.google.com/spreadsheets/d/1d2RnsDMZYmnmnBpdtPpmTuoIxkP3uDhdLOQ7pB3An94/edit?usp=sharing


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>