简体   繁体   中英

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. 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 ):

  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. 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. Using * is not accepted as ALL in this case, and I can't seem to find something that works.

I used another script to run an Excel macro on the document before converting it. This macro changed the name of the cell range to a common name that is now used to convert the document.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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