ServiceException:方法不允许

时间:2015-10-18 10:19:18

标签: java android google-drive-api spreadsheet worksheet

您好我试图在Google工作表中插入一行,但我不能这样做因为有这个错误:

Exception in thread "main" com.google.gdata.util.ServiceException: Method Not Allowed
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:632)
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.insert(Service.java:1409)
at com.google.gdata.client.GoogleService.insert(GoogleService.java:613)
at it.unical.mat.spreadsheet.Main.main(Main.java:64)

请帮我解决这个问题,这是我的代码:

public class MyClass {
public static void main(String[] args)
    throws AuthenticationException, MalformedURLException, IOException, ServiceException
{

 SpreadsheetService service = new SpreadsheetService("MyApp");
 FeedURLFactory factory = FeedURLFactory.getDefault();
 String key = "***my_key***";
 URL spreadSheetUrl = factory.getWorksheetFeedUrl(key,"public","full");
 WorksheetFeed feed = service.getFeed(spreadSheetUrl, WorksheetFeed.class);

 WorksheetEntry worksheet = feed.getEntries().get(13);
 URL url = worksheet.getListFeedUrl();


 ListEntry row = new ListEntry();
 row.getCustomElements().setValueLocal("header", "aaa");

 row = service.insert(url, row);
 }
}

我的目的是在Google工作表中插入新行!

如果阅读行我没有遇到问题,但问题是在写入行时出现问题!

0 个答案:

没有答案