I am really stuck with this problem because it was working fine some two
days ago or so.
What i have done is uploading the xls file using the DocumentListEntry which
gives me SpreadsheetEntry and then trying to get the first worksheetEntry
from the newly created SpreadsheetEntry as follows:
SpreadsheetEntry.getWorksheets().get(0). I have 3 worksheets on my uploaded
xls file. But when trying to get the first worksheet, i am getting *Not
Found* error. As already mentioned, this was working fine some days ago.
To make it more clear, i am providing my sample code below:
private DocumentListEntry uploadFile(String filepath, String title) throws
IOException, ServiceException {
File file = new File(filepath);
String mimeType =
DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType();
SpreadsheetEntry spreadsheetEntry = new SpreadsheetEntry();
spreadsheetEntry.setFile(file, mimeType);
spreadsheetEntry.setTitle(new PlainTextConstruct(title));
spreadsheetEntry = client.insert(new
URL("https://docs.google.com/feeds/default/private/full/"),
spreadsheetEntry);//*client is an authenticated DocsService object*
myService = new SpreadsheetService("openentry-catalog-1");//*myService
is an authenticated SpreadsheetService object*
myService.setAuthSubToken(sessionToken, privateKey);
SpreadsheetEntry spreadsheet = (SpreadsheetEntry) spreadsheetEntry;
WorksheetEntry companyWorksheet =
spreadsheet.getWorksheets().get(0); //*at this point the exception is thrown
which is listed below*
}
*Thrown Exception*
com.google.gdata.util.ResourceNotFoundException: OK
<HTML>
<HEAD>
<TITLE>Not Found</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Not Found</H1>
<H2>Error 404</H2>
</BODY>
</HTML>
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:555)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:536)
at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:515)
at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.getFeed(Service.java:1073)