I want to integrate Google Drive (to create folders and spreadsheets) and Sheets API (to populate spreadsheets) in Android without using Account Manager for authentication. Hence I am using Drive API v2 Client Library for Java for drive integration and Sheets API for spreadsheets. I have successfully implemented OAuth2.0 authentication and drive integration (Create folders and spreadsheets), however I am unable to use Sheet API due to "x method is undefined for y" type of errors.
I authorized Sheet API Service as follows :
SpreadsheetService service = new SpreadsheetService("Aplication-name");
service.setAuthSubToken(credential.getAccessToken());
I am able to print the list of spreadsheets.However, when I try to edit the worksheet dimensions, using setColCount(int) and setRowCount(int), it shows following error :
The method setColCount(int) is undefined for the type WorksheetEntry
The method setRowCount(int) is undefined for the type WorksheetEntry
But as per Sheets API Documentation, the methods should work as follows :
// Get the first worksheet of the first spreadsheet.
// TODO: Choose a worksheet more intelligently based on your
// app's needs.
WorksheetFeed worksheetFeed = service.getFeed(
spreadsheet.getWorksheetFeedUrl(), WorksheetFeed.class);
List<WorksheetEntry> worksheets = worksheetFeed.getEntries();
WorksheetEntry worksheet = worksheets.get(0);
// Update the local representation of the worksheet.
worksheet.setTitle(new PlainTextConstruct("Updated Worksheet"));
worksheet.setColCount(5);
worksheet.setRowCount(15);
// Send the local representation of the worksheet to the API for
// modification.
worksheet.update();
I am able to use worksheet.getColCount() and worksheet.getRowCount() methods but the set methods are not working.
I have imported following JARs for Drive integration as per instructions given here :
google-api-client-1.20.0.jar
google-oauth-client-1.20.0.jar
google-http-client-1.20.0.jar
jsr305-1.3.9.jar
google-http-client-jackson2-1.20.0.jar
jackson-core-$2.1.3.jar
google-api-client-android-1.20.0.jar (for SDK >= 2.1)
google-http-client-android-1.20.0.jar
and following JARs for Sheets integration instructions given here:
gdata-appsforyourdomain-1.0
gdata-base-1.0
gdata-calendar-1.0
gdata-client-1.0
gdata-codesearch-1.0
gdata-photos-1.0
gdata-spreadsheet-1.0
guava-11.0.2
jsr305
javax.mail
Can it be because of some kind of conflicts between imported JARs? Any help is appreciated. Thanks in advance!