我们使用Google文档列表API导出不同的文档类型,在尝试以xls格式请求时,我们遇到了特定电子表格的以下错误:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.google.gdata.util.ServiceException: Conversion failed unexpectedly
<HTML>
<HEAD>
<TITLE>Conversion failed unexpectedly</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Conversion failed unexpectedly</H1>
<H2>Error 500</H2>
</BODY>
</HTML>
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:624)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.media.MediaService.getMediaResource(MediaService.java:234)
at com.google.gdata.client.media.MediaService.getMedia(MediaService.java:276)
at com.google.gdata.client.media.MediaService.getMedia(MediaService.java:302)
对于同一个电子表格,此错误已持续数天。我们自己调查了一下并得出结论,导出失败的格式是xls / xlsx和ods,但是例如csv和html可以工作。这就是我们的REST调用的样子:
fails: https://docs.google.com/feeds/download/spreadsheets/Export?key={ID}&xoauth_requestor_id={email}&exportFormat=xls
fails: https://docs.google.com/feeds/download/spreadsheets/Export?key={ID}&xoauth_requestor_id={email}&exportFormat=ods
succeeds: https://docs.google.com/feeds/download/spreadsheets/Export?key={ID}&xoauth_requestor_id={email}&exportFormat=csv
我们还尝试添加旧的format=
属性,但它没有改变行为,因此我们再次将其删除。
由于Google文档正在被Google云端硬盘取代,我们明年会考虑转换为Google Drive API,这可能有用,但与此同时,能够在当前版本中解决这个问题会很好
在我们这边,我正试图与客户联系,看看他们是否可以在实际的电子表格中看到任何奇怪的内容。我会在收到的时候添加我发现的任何信息。
Google上的搜索没有提供太多,所以我希望此前有人见过这一点,并且知道可能发生这种情况的一些情况。任何看过这个的人以及你为了解决这个问题所做的任何评论都会有所帮助!
提前致谢!