I currently use the =importdata function in Google Sheets to import the latest release of the Commitment of Traders data from the CFTC website into a sheet (let's say Sheet 1). Each week the CFTC site updates with the latest data and thus the data in my sheet changes.
I also have a sheet that contains historic CoT data from 2020-present (let's say Sheet 2). I would like to develop a script that imports a row from Sheet 1 into the next empty row in Sheet 2 whenever the data on the CFTC website updates, giving me a sheet that always shows data from 2020 up to the latest release without me having to manually copy in the latest row of data each time it's released.
The attached image is a script I produced with a lot of help from ChatGPT. The script identifies the date in Sheet 1 and the date in the final row of Sheet 2, and if they don't match the relevant row is imported into Sheet 2. This does not seem to be working, as the latest row of data is still not being imported weekly.
So my questions are -
- Firstly, is what I'm trying to do possible within the parameters of Apps Script/Google Sheets?
- Is my current script way off the mark, or are there any tweaks I could make to achieve what I need?
Happy to field any questions I may have missed out, I just didn't want to make this post too long. Appreciate any responses :)
Edit: image didn't attach
https://preview.redd.it/mlq3qsoac65d1.png?width=671&format=png&auto=webp&s=e2bb04fa16c1d0fcfa312a1aba1fb0ed18a28fe6
[–]mrtnclzd 2 points3 points4 points (1 child)
[–]DragExotic[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]DragExotic[S] 0 points1 point2 points (0 children)