Using control-flow "for" in function "gads_get_report"

Hello everyone!

When I start control-flow under i see a mistake:
"The request you sent did not return any results, check the entered parameters and repeat the opposition." The problem is in arguments "date_from" and "date_to". How can I solve this problem?

for_download_dates <- data.frame(date = seq(as.Date('2022-05-12'), as.Date(Sys.Date()-1), 'days'));

done_dates <- data.frame(date = unique((read.csv('C:\Users\xxxxxxxxxx\Desktop\dataframe_for_bi_new.csv'))$date));

sort(filter(for_download_dates, !(for_download_dates$date %in% done_dates$date))$date)

for (date in sort(filter(for_download_dates, !(for_download_dates$date %in% done_dates$date))$date))
{

googleads_report <- gads_get_report(
resource = "campaign",
fields = c("segments.date",
"campaign.name",
"metrics.impressions",
"metrics.clicks",
"metrics.cost_micros"),
customer_id = c("xxx-xxx-xxxx", "xxx-xxx-xxxx"),
login_customer_id = ("xxx-xxx-xxxx"),
date_from = as.Date(date, origin = "1970-01-01"),
date_to = as.Date(date, origin = "1970-01-01")) %>%
mutate(cost = cost*65)
}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.