Hi,

I am trying to insert some data into a public spreadsheet at my g-drive 
account using Java.
The URL of spreadsheet is 
https://docs.google.com/spreadsheet/ccc?key=0Av4aUydPYoNAdHV2MnRaSFhrY0NSZnNOS28yTlhRTVE
 .

Now I have this piece of code to connect Java to that spreadsheet:

package main;
import com.google.gdata.client.spreadsheet.*;import 
com.google.gdata.data.spreadsheet.*;import com.google.gdata.util.*;
import java.io.IOException;import java.net.*;
public class Main{
    public static void main(String[] args) throws AuthenticationException, 
MalformedURLException, IOException, ServiceException
    {
        // Specifying a version
        SpreadsheetService service = new 
SpreadsheetService("MySpreadsheetIntegration");
        service.setProtocolVersion(SpreadsheetService.Versions.V3);

        // Define the URL to request
        URL SPREADSHEET_FEED_URL = new 
URL("https://spreadsheets.google.com/feeds/worksheets/0Av4aUydPYoNAdHV2MnRaSFhrY0NSZnNOS28yTlhRTVE/public/full";);

        // Make a request to the API and get all spreadsheets
        SpreadsheetFeed feed = service.getFeed(SPREADSHEET_FEED_URL, 
SpreadsheetFeed.class);

        System.out.println("WorksheetFeedTitle: " + 
feed.getEntries().get(0).getTitle().getPlainText());
    }}


but it returns:

Exception in thread "main" com.google.gdata.util.InvalidEntryException: Bad 
> Request
> Não foi possível encontrar a folha de cálculo neste URL. Certifique-se de 
> que possui o URL correcto e que o proprietário da folha de cálculo não a 
> eliminou.
> at 
> com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:602)
> at 
> com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
> at 
> com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
> at 
> com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
> at 
> com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
> at com.google.gdata.client.Service.getFeed(Service.java:1135)
> at com.google.gdata.client.Service.getFeed(Service.java:998)
> at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
> at com.google.gdata.client.Service.getFeed(Service.java:1017)
> at main.Main.main(Main.java:22)


and if I change the line 19 to :

URL SPREADSHEET_FEED_URL = new 
URL("https://spreadsheets.google.com/feeds/worksheets/0Av4aUydPYoNAdHV2MnRaSFhrY0NSZnNOS28yTlhRTVE/private/full";);


it returns:

Exception in thread "main" com.google.gdata.util.ResourceNotFoundException: 
> Not Found
> <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:599)
> at 
> com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
> at 
> com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
> at 
> com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
> at 
> com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
> at com.google.gdata.client.Service.getFeed(Service.java:1135)
> at com.google.gdata.client.Service.getFeed(Service.java:998)
> at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
> at com.google.gdata.client.Service.getFeed(Service.java:1017)
> at main.Main.main(Main.java:22)


What happen with my code? Why I cannot access to my public spreadsheet 
through java?


--
Cheers

Reply via email to