Data for Aug 1 Data for Aug 2 Data for Aug 3 Desired Output
1 5 8 14
2 4 9 15
3 3 10 16
4 2 11 17
5 1 12 18
Let’s say the values starts at Row 2 Column A in a sheet called Sheet1.
let ss = SpreadsheetApp.getActiveSpreadsheet();
let sheet1 = ss.getSheetByName('Sheet1');
let values = sheet1.getRange(2,1,sheet1.getMaxRows()-1,3).getValues();
How do I get the desired output above? The column numbers and column counts are not fixed and may change according to a date range selection. For example, a user may choose to find only the sum from Aug 2 to Aug 3, or from Aug 1 to 3.
I have seen posts about getting the sum of all rows in a column using for loop or reduce. But haven’t seen a post about cumulative sum per row across a group columns.