简体   繁体   English

在SQL FROM语句中使用'*'访问Excel单元格范围

[英]Using '*' in SQL FROM statement to access Excel cell range

I have a script that converts an .xlsx file to .csv file but this script uses a cell range in Excel to read the data. 我有一个脚本,可以将.xlsx文件转换为.csv文件,但是此脚本使用Excel中的单元格区域来读取数据。 The script is working but I wish to expand it to prevent possible user-bugs. 该脚本正在运行,但我希望对其进行扩展以防止可能的用户错误。

The query to select a Excel cell range (in SQL ): 查询以选择Excel单元格范围(在SQL中 ):

  string query = "SELECT * FROM fileName";

What I'm trying to do is make the script select an 'ALL' kind of range so that if a user changes the filename it still works. 我正在尝试做的是使脚本选择“ ALL”类型的范围,这样,如果用户更改文件名,它仍然可以工作。 Like this: 像这样:

  string query = "SELECT * FROM User_*";

User_ will be standard for every document but what comes after the _ can be changed by the users. User_是每个文档的标准,但是_之后的内容可由用户更改。 Using * is not accepted as ALL in this case, and I can't seem to find something that works. 在这种情况下,不接受使用*作为ALL,而且我似乎找不到有效的方法。

I used another script to run an Excel macro on the document before converting it. 在转换文档之前,我使用了另一个脚本在文档上运行Excel宏。 This macro changed the name of the cell range to a common name that is now used to convert the document. 此宏将单元格区域的名称更改为现在用于转换文档的通用名称。

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

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