I would like to be able to log the last value with yesterdays timestamp to a completely different Google sheet, but am a bit stomped by the complexity of this.
I have a sheet that logs "daily_gains" (column U) values at random intervals. The time/date (column B) and daily gains column look something like this;
|date/time (B) |daily_gains (U) |
|:------------------|---------------:|
|12 Aug 2021, 06:16 | |
|12 Aug 2021, 06:05 | |
|12 Aug 2021, 05:55 | |
|12 Aug 2021, 05:50 | |
|12 Aug 2021, 04:30 | 2.225 |
|12 Aug 2021, 04:25 | |
|12 Aug 2021, 04:15 | |
|12 Aug 2021, 04:05 | |
|12 Aug 2021, 04:00 | |
|12 Aug 2021, 03:55 | |
|12 Aug 2021, 03:20 | -1.129 |
|12 Aug 2021, 03:10 | |
|12 Aug 2021, 03:00 | |
|12 Aug 2021, 02:35 | |
|12 Aug 2021, 02:30 | |
|12 Aug 2021, 02:25 | |
|11 Aug 2021, 20:30 | -3.306 |
|11 Aug 2021, 20:25 | |
|11 Aug 2021, 20:10 | |
|11 Aug 2021, 19:30 | |
|11 Aug 2021, 18:40 | |
|11 Aug 2021, 18:30 | |
|11 Aug 2021, 15:45 | -2.819 |
|11 Aug 2021, 15:41 | |
What I am trying to do is: Everyday, sometime after midnight, I would like to copy the last daily_gains
value from the previous day to a different spreadsheet.
In this case, on 12 Aug 2021, 00:10, I would like to copy the value -3.306
to a new spreadsheet.
I have found this thread: Daily calculation and record insertion in Google Spreadsheet which helps some explaining how to use apps script, but it copies from a specific cell to a new sheet in the same document. And my coding knowledge doesn't quite let me extrapolate my specific use case from that.
edit: This spreadsheet shows the data I have and what I am trying to achieve: https://docs.google.com/spreadsheets/d/1fglFHDZOxOfiipMjB9sXWpdzCdgvhZ_PYIrdfPpfL98/edit?usp=sharing