简体   繁体   English

通过脚本用Office365 Excel打开CSV

[英]Open CSV with Office365 Excel through Script

Goal目标

Open a CSV file with Office365's Excel without saving the file on the client machine使用 Office365 的 Excel 打开 CSV 文件,而无需将文件保存在客户端计算机上

Problem问题

Saving the raw data on the client machine will lead to a lot of old excel files laying around and I would like to prevent this.将原始数据保存在客户端机器上会导致大量旧的 excel 文件出现,我想防止这种情况发生。 In a perfect world, I would like to have a button in my application that says "Export to Excel" which opens office365's excel application with the data.在一个完美的世界中,我希望在我的应用程序中有一个按钮,上面写着“导出到 Excel”,它会用数据打开 office365 的 excel 应用程序。 Just as you would do with a local installation.就像在本地安装一样。 After migrating to the cloud, saving files locally, this feels like a step in the wrong direction.迁移到云端后,在本地保存文件,这感觉就像是在错误的方向上迈出了一步。

Is it possible to send data to an excel sheet with scripting?是否可以使用脚本将数据发送到 Excel 工作表?

Background背景

This is an internal application that will not be accessible online and my users are using Google Chrome.这是一个无法在线访问的内部应用程序,我的用户正在使用 Google Chrome。

Manual Solution (Not accepted)手动解决方案(不接受)

  1. Save the file on the machine将文件保存在机器上
  2. Open Excel打开 Excel
  3. Use the import tool使用导入工具

Possible Solution if nothing else (over engineering)如果没有别的可能的解决方案(在工程上)

  1. Backend sets up a network drive后端设置网络驱动器
  2. Saves the CSV to the drive将 CSV 保存到驱动器
  3. User opens Excel and imports the file from his/her space on the shared drive用户打开 Excel 并从他/她在共享驱动器上的空间导入文件

This feels wrong.这感觉不对。 Is it possible to open a tab with excel, use some kind of local storage space, window events, broadcasting channel or query arguments to insert data?是否可以用excel打开选项卡,使用某种本地存储空间、窗口事件、广播频道或查询参数来插入数据? Query is probably the worst possible option as I dont know the size of the data.查询可能是最糟糕的选择,因为我不知道数据的大小。 I can't seem to find the right documentation for this.我似乎无法为此找到正确的文档。

You could try storing the csv raw data into a SQL database and then have a single html page that connects to the DB and displays the plain text on a blank html page.您可以尝试将 csv 原始数据存储到 SQL 数据库中,然后将单个 html 页面连接到数据库并在空白 html 页面上显示纯文本。 Maybe add a security token using a GET request and then all you would have to do is open the url from within excel instead of a file on the local computer.也许使用 GET 请求添加安全令牌,然后您要做的就是从 excel 中打开 url 而不是本地计算机上的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM