Is there a way to add a line to Google Spreadsheet without OAuth using java?

I searched many websites on how to do this, using only the spreadsheet key, but without success. I can get it, get all the data I want, but I can not add a new row to it.

I have already published my spreadsheet on the Internet and made it publicly available, but I continue to receive "com.google.gdata.util.ServiceException: method not allowed".

What am I trying to do:

SpreadsheetService service =
            new SpreadsheetService("MySpreadsheetIntegration-v1");

        try {

        URL url = FeedURLFactory.getDefault().getWorksheetFeedUrl(SpreadsheetRequest.KEY, "public", "full"); //KEY = "1cenwTRlrGMzMTufkK27IIgAHvEGwVKR9Yr59Qako3u0";

        WorksheetFeed worksheetFeed = service.getFeed(url, WorksheetFeed.class);
        List<WorksheetEntry> worksheets = worksheetFeed.getEntries();
        WorksheetEntry worksheet = worksheets.get(0);

        URL listFeedUrl = worksheet.getListFeedUrl();

        ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class);
        List<ListEntry> list = listFeed.getEntries();

       //Checking all the entries, works like a charm
        for (ListEntry row : list) {
            Log.i("INSERT",row.getTitle().getPlainText() + "\t"
                    + row.getPlainTextContent());
        }

        ListEntry row = new ListEntry();

        row.getCustomElements().setValueLocal("id", "21");
        row.getCustomElements().setValueLocal("type", si.getType().toString());
        row.getCustomElements().setValueLocal("longitude", String.valueOf(si.getLongitude()));
        row.getCustomElements().setValueLocal("latitude", String.valueOf(si.getLatitude()));
        row.getCustomElements().setValueLocal("last_maint", String.valueOf(si.getLast()));
        row.getCustomElements().setValueLocal("inst_date", String.valueOf(si.getInst()));

        row = service.insert(listFeedUrl, row); //Exception is thrown here

        return true;
    }
+4
source share
2 answers

№ . OAuth , Google , , , . Google , OAuth Google , .

. , , , Google, . , .

enter image description here

+1

API Google OAUTH2.0. , API Google .

, OAUTH2.0 !

Java OAUTH2.0 ----- >

0

All Articles