安排Google Analytics csv报告的导出

I would like to have a copy of one of the Analytics custom reports as CSV on a webserver every day. I wish to update some records in my database depending on this csv report.

Before I would start, will it work if I

  1. find the analytics core java api code of fetching reports, compile and save it
  2. set a cronjob daily which runs a php file
  3. the php file executes a bash command that calls java
  4. the java application interacts with analytics, gets and saves the report
  5. the php file checks if the new csv exists, reads the file, gets information
  6. the php file connects to mysql and updates records

Please correct me if it's bullsh.t or there are easier ways (Analytics PHP/JS API if exists, or something else). These six points just popped in my head, I've never done something like this before, so please help me.

The Core Reporting API is language agnostic and there are libraries for many languages including PHP. So I'd say calling Java via PHP is unnecessarily complicated.