// The start and end dates for data to retrieve. These should be of the
// form YYYY-MM-DD.
String startDate = args[3];
String endDate = args[4];
SpreadsheetService spreadsheetService = new SpreadsheetService(APP_NAME);
spreadsheetService.setUserCredentials(username, password);
// Workaround for Google Data APIs Java client issue #103
// (http://code.google.com/p/gdata-java-client/issues/detail?id=103)
spreadsheetService.setProtocolVersion(SpreadsheetService.Versions.V1);
AnalyticsService analyticsService = new AnalyticsService(APP_NAME);
analyticsService.setUserCredentials(username, password);
SpreadsheetExporter exporter = new SpreadsheetExporter(spreadsheetService, analyticsService);