将 csv 转换为 html 形式的 Google 电子表格
我有一个带有一些选项的小型 html 表单。根据用户的选择,当前单击按钮将导致下载包含相关信息的 csv 文件。我理想中想做的是,当用户通过表单请求时,能够以编程方式从该 csv 文件生成 Google 电子表格。
我找不到这个信息。为此我需要 Spreadsheet 的 API 还是有更简单的方法?
非常感谢!
I have a small html form with some options. Based on the user's selection, currently the button click will result in the downloading of a csv file with the relevant information. What I ideally like to do is to be able to generate programatically a Google Spreadsheet from that csv file when the user requests it via the form.
I couldn't find this info. Will I need Spreadsheet's APIs for this or is there a simpler way?
Many thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您需要使用 Google 文档列表数据 API。这将要求您使用适当的参数(在链接中描述)对此 API 进行并经过身份验证的 POST 调用。对于 Java 和 .NET,Google 开发了一些库,使这项工作变得更加容易,但您可以从任何应用程序/语言调用 API,只需查看文档上的“协议”说明即可。
一种更简单的方法是使用 Google Apps 脚本,这是一种内置于Google 电子表格和网站。可以编写一个类似于 html 表单的界面。您将受益于它与 Google 电子表格高度集成。使用 2 行代码(字面意思),您可以使用 csv 值创建一个新的电子表格。
Yes, you need to use the Google Documents List Data API. Which will require that you make and authenticated POST call to this API with the appropriate parameters (described on the link). For Java and .NET Google developed some libraries that makes this job much easier, but you can call the API from any app/lang, just take a look at the "protocol" explanations on the documentation.
A think a simpler way would be to use Google Apps Script, a server-side javascript built into Google Spreadsheets and Sites. It's possible to write an interface to look like your html form. You'll have the advantage of it being highly integrated with Google spreadsheets. With 2 lines of code (literally) you can create a new spreadsheet with you csv values.