excel - 如何在未安装 Office 的情况下在 ArcMap 中打开 .xls 文件?
问题描述
我正在尝试在 ArcMap 10.6.1 的目录窗口中打开和复制 xls 文档。每次我尝试展开表格时,都会收到以下错误消息:
“连接数据库失败。一般功能失败。外部表没有预期的格式。” (从德语翻译)
我尝试安装(然后更新)“2007 Office System Driver:Data Connectivity Components”和“Microsoft Access Database Engine 2010 Redistributable”,但这没有帮助。
我在没有安装 Office 的情况下在 Windows Server 2012 R2 上运行 ArcGIS 10.6.1。有趣的是,在另一台机器上,运行 ArcGIS 10.5.1,操作系统相同,没有 Office,它工作正常!
解决方案
试试这个,它可以帮助您使用 arcpy 窗口读取和使用 .xls 中的数据:
import arcpy
import xlrd
inputExcel = xlrd.open_workbook("C:\Users\username\In_excel.xls")
sheetNames = inputExcel.sheet_names()
excelSheet = inputExcel.sheet_by_name(sheetNames[0])
for x in range (0, excelSheet.nrows):
for y in range (0 excelSheet.ncols):
cellValue = excelSheet.cell_value(x, y)
print (cellValue)
推荐阅读
- ruby - 捆绑安装到现有铁路项目会导致 gem 文件错误
- arduino - ESP8266 Httpclient get 方法有效,但不适用于 mfrc522
- scala - sbt 运行错误:java.lang.RuntimeException:非零退出代码:1
- python - 如何在 Python 中不等待线程完成
- parsing - FParsec:如何保存解析器成功的文本
- jquery - 使用 jQuery 删除图像时,参数不显示文件字段键
- python - 如何在 tensorflow 的源代码中打印(跟踪)
- oracle - 视图内表格的完整提示
- android - appcompat 版本出现错误
- linux - Linux 正则表达式不适用于 AWK