For querying the API from R you can use the httr2
package, for exporting data to excel there are many package options, one example is openxlsx
, and for scheduling an R script you can use taskscheduleR
or cronR
depending on your Operating System.
If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.