Hello everyone,
I am quite new to Java and new to the Google Data API's. I am trying to
change the size of a worksheet in a publicly shared spreadsheet. I'm using
the following code:
static void writeToGoogleSpreadsheet(String spreadsheetKey) throws
IOException, ServiceException {
SpreadsheetService service = new
SpreadsheetService("com.example");
String urlString =
"https://spreadsheets.google.com/feeds/worksheets/" + spreadsheetKey +
"/public/basic";
URL url = new URL(urlString);
try {
WorksheetFeed worksheetFeed = service.getFeed(url,
WorksheetFeed.class);
List<WorksheetEntry> worksheets = worksheetFeed.getEntries();
WorksheetEntry worksheet = worksheets.get(0);
System.out.println(worksheet.getTitle().getPlainText());
System.out.println(worksheet.getCanEdit());
// Update the local representation of the worksheet.
worksheet.setTitle(new PlainTextConstruct("Updated Worksheet"));
worksheet.setColCount(40);
worksheet.setRowCount(40);
// Send the local representation of the worksheet to the API for
// modification.
worksheet.update();
} finally{}
}
The console displays the correct worksheet title and size, so I'm pretty
sure I am accessing the right worksheet. However, worksheet.update() throws
the following exception:
Exception in thread "main" java.lang.UnsupportedOperationException: Entry
cannot be updated
at com.google.gdata.data.BaseEntry.update(BaseEntry.java:635)
atcom.example.GoogleSpreadsheetCommunicator.writeToGoogleSpreadsheet(GoogleSpreadsheetCommunicator.java:119)
at com.example.Main.guildSim(Main.java:114)
at com.example.Main.main(Main.java:73)
Does anyone know what I am doing wrong?
Thanks for reading and kind regards,
Karel
--
You received this message because you are subscribed to the Google Groups
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.