[英]Upload CSV to Google Drive Spreadsheet using Drive v2 Java API
I am trying to upload a CSV as a Google spreadsheet 我正在尝试将CSV上传为Google电子表格
I do see that there is a request parameter convert=true available at 我确实看到有一个请求参数convert = true available at
Google Developer - insert. Google开发者 - 插入。
Can some one help me on how to set this flag in Java API? 有人可以帮助我如何在Java API中设置此标志吗?
The Drive.Files.Insert
class has a setConvert
method that you can use before calling execute
. Drive.Files.Insert
类有一个setConvert
方法,您可以在调用execute
之前使用该方法。 Using the file.insert sample as reference, you have to replace the following line: 使用file.insert示例作为参考,您必须替换以下行:
File file = service.files().insert(body, mediaContent).execute();
with: 有:
File file = service.files().insert(body, mediaContent).setConvert(true).execute();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.