Help with OleDb Connection Query

Hello guys ,

I am using database connection to connect to an excel. I want to select only column L where column L contains ‘PSM’, ‘VNM’, ‘TAMD’, ‘X00’

i wrote this but its not working “Select [F12] From [Sheet1$] Where [F12] In (‘PSM’, ‘VNM’, ‘TAMD’, ‘X00’)”

However when i tried “Select * from [Sheet1$L:L]” it worked but i would want to add IN (‘PSM’, ‘VNM’, ‘TAMD’, ‘X00’)

Please help


Hi @bcorrea Please…Thanks a lot, one more time pleaseeee, Thanks i am so grateful

If F12 is a column name then the below would work fine:
select * from [Sheet1$] where [F12] in ('2','1','3')

Hello Thanks a lot for your response. I do not have any column name …

It is impossible, every datatable column needs to have a name…

when i performed the Select * from [Sheet1$]… the excel didn’t have a header, does this mean that its taking my row 0 which is actual data as a header. please How do i make it read with its own default headers as my excel doesn’t have headers

I mean even if your excel dont have headers, you can specify HDR=NO in your connection string and the columns will be F1,F2,F3… and your query will be like:
select * from [Sheet1$] where [F8] in ('2','1')


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.