Reputation: 199
I have to read a 450 column excel file and dump few of the column (150+) information into SQL.
I have splitted the excel into 2 parts and then merging. Is it possible to replace the excel column names in the below named range query .
SELECT *
FROM [Sheet1$A:GR]
Expected query:
SELECT F1, F2, F3, F45, F78, .....
FROM [Sheet1$]
SELECT colName, colPlace, colAnimal, colThing, .....
FROM [Sheet1$]
I have tried the above 2 options but this doesn't work.
Upvotes: 1
Views: 1913
Reputation: 37313
You can specify columns names in SQL command while querying an excel file, you have to make sure that:
If the Excel connection is configured to read first row as header then you should use a similar approach:
SELECT [column name 1], [column name 2] FROM [Sheet1$]
If first row doesn't contain header then you should use [1], [2], ...
You can refer to the following articles for more details:
Upvotes: 1