- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我需要一个命令行工具来将 excel 和 ods 电子表格文件转换为 csv,我可以在网络服务器(Ubuntu 16.04)上使用它。我已经红色了:https://pypi.python.org/pypi/unotools这对于给定的示例效果很好。
还有这个:http://www.linuxjournal.com/content/convert-spreadsheets-csv-files-python-and-pyuno-part-1v2它应该完成我想要它完成的工作,但在我的环境中却没有。
我认为我的问题出在 Calc.store_to_url 方法中:
抛出异常
component.store_to_url(url,'FilterName','文本 - txt - csv (StarCalc)')
我真的很感谢您的提示。
异常
unotools.unohelper.ErrorCodeIOException:SfxBaseModel::impl_store 失败:0x81a
完整来源
import sys
from os.path import basename, join as pathjoin, splitext
from unotools import Socket, connect
from unotools.component.calc import Calc
from unotools.unohelper import convert_path_to_url
from unotools import parse_argument
def get_component(args, context):
_, ext = splitext(args.file_)
url = convert_path_to_url(args.file_)
component = Calc(context, url)
return component
def convert_csv(args, context):
component = get_component(args, context)
url = 'out/result.csv'
component.store_to_url(url,'FilterName','Text - txt - csv (StarCalc)')
component.close(True)
args = parse_argument(sys.argv[1:])
context = connect(Socket(args.host, args.port), option=args.option)
convert_csv(args, context)
最佳答案
URL 必须采用 file://
格式。
url = convert_path_to_url('out/result.csv')
请参阅 https://pypi.python.org/pypi/unotools 处的 store_to_url
示例.
编辑:
要使用绝对路径,请选择其中之一;无需将它们组合起来。
url = 'file:///home/me/out/result.csv'
url = convert_path_to_url('/home/me/out/result.csv')
要使用相对路径,首先通过调用 os.getcwd() 验证工作目录是否为“/home/me” .
关于python - unotools - 尝试使用 python 将 ods 或 excel 文件转换为 csv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42721321/
我正在尝试导入数据(.ods 文件),并且我知道如何导入 .csv、.xls 等,但我一直处于困境。我用 Gnumeric 包进行了尝试,但 R 告诉我找不到所需的程序“ssconvert”。 最佳答
我认为这里的答案将来自经验。 我想知道操作数据存储 (ODS) 的真正目标是什么我正在浏览网页,但如果可能的话,我希望有一个真实的案例反馈。 我有几个问题: ODS 是Operational 端的,那
我试图在创建 ods 文件之前找到一种方法来设置每个单元格的边框和每列的最佳宽度[或者在文件创建之后 - 我不介意]。我正在用 Java 编写程序,并使用 jopendocument 库创建 ods
CMAKE_BUILD_TYPE 是Release,我试过这个来禁用优化: set(CMAKE_CXX_FLAGS "-Od ${CMAKE_CXX_FLAGS}") 但它不起作用,它显示: cl :
send_mail('Subject here', 'Here is the message.', 'selva@gmail.com', ['stab@gmail.com'], fail_silent
如何在 JTable 中查看 .ods 文件中的工作表?我正在使用 odftoolkit simple api,这就是我打开文件的方式 String filepath; if
我正在寻找一种将数据从一堆文本文件导入 .ods 文件的有效方法。我在使用 grep 和 sed 等命令处理文本文件时没有问题,但是,我不知道是否可以将这些命令的结果重定向到 ods 文件中的某个位置
我想将我的电子表格数据转换为 JSON 数组。 这个网站做的:http://www.shancarter.com/data_converter/index.html我查看了源代码。 但我想要的是一个宏
假设我有 8b1f 0008 0231 49f6 0300 f1f3 75f4 0c72 f775 0850 7676 720c 560d 75f0 02e5 ce00 0861 1302 0000
我想导出由PROC TABULATE生成的表。我的代码是这样的: ODS EXCEL FILE="myFile.xlsx" (options sheet_name="CRIME TYPE"); P
我当前的项目使用 ODS Excel,而不是 ODS Tagsets.Excelxp。到目前为止一切顺利,我比 tagets.excelxp 更喜欢它,尽管它有一些差异。 我正在创建名为“CRE Re
我正在尝试做一些我认为很简单的事情。我想将指向 xls 工作簿的链接插入到在 GPLOT 中生成的图表的标题中,并通过 ODS 作为 PDF 输出。 我试过: ods escapechar="^";
当我尝试在方法内或大括号内声明一个变量(如 int),然后我想稍后在大括号外更改变量的值时,它似乎不起作用。我是不是做错了什么?我如何让它工作?我是 Java 的新手,如果这看起来是一个非常基本的问题
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
什么是 od 的 windows 等效命令 在 Linux 中 - echo xxxxx |发布网址 | od-xv 那么 Windows 中的等效命令是什么? 最佳答案 od 是 CoreUtils
对不起我的英语... 我正在尝试实现 phpexcel 来读取不同类型的文件,特别是 .xls、.xlsx 和 .ods 文件。 我正在使用 this example用于我的测试 使用 .xls 文件
在 MSVC 2012 的调试过程中,我尝试从 Watch 窗口调用一些函数,以便将数据转储到文件中。但是,我不断收到此错误: Function Matrix::Save has no address
我经常在 SAS 中编写通用宏。在我的宏中,我想应用一些设置,比如 宏变量 SAS 选项 ODS 选项 但事后我想“收拾残局”。 对于将是的宏变量 %macro myMac(); %let o
我正在运行一个宏程序来分析数据集。在我的宏结束时,我使用了 ODS 语句和 proc 报告来导出我的结果。我想要的是:每次我使用新数据集运行宏程序时,结果将在同一 Excel 文件的新工作表中更新,而
我已经安装了develop/6在我的 Ubuntu 机器上从 Virtuoso 分支。显然一切正常,但是当我尝试安装 ODS 框架时出现以下消息错误: 00000 Errors detected 00
我是一名优秀的程序员,十分优秀!