Data Connection SQL Like Syntax against xlsx data

tweedle

Well-known Member
Joined
Aug 1, 2010
Messages
1,559
Would someone kindly point out the errors of my ways....
The end question is what's the syntax/wildcard for using the LIKE operator against Excel data?

Scenario:
I've got wb2 attempting to data connect to wb1 and pull back using the following :

Code:
SELECT * 
FROM  [Aggregate$] 
WHERE [Summary] [COLOR=blue]Like[/COLOR] [COLOR=blue]'*restore*'[/COLOR];

Also tried 'restore', '*restore*', '%restore%', "*restore*", "%restore%" and = '*restore*' .... to no avail.

I'm not getting errors, but I'm not getting data either :confused:
Uses Driver: Microsoft.ACE.OLEDB.12.0 [save 1 blog, zero documentation on msdn]

Data Sample:
<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 10pt; FONT-FAMILY: Arial,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 438px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD></TD><TD>BT</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD style="FONT-WEIGHT: bold">Summary</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD>user had a question about file restore</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD>user needs a file restored on the S drive</TD></TR><TR style="HEIGHT: 17px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD>User lost her Salesforce menu in outlook. restored it.</TD></TR></TBODY></TABLE>
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Contains seems to be SQL Server specific; never got contains to work against Excel.

Ulimately got this format to work
Code:
SELECT 
*
FROM `PATH\File.xlsx`.`named range` WHERE lcase(Summary) LIKE '%restore%'
(which is the construct I expected)

Connection (ODBC):
DSN=Excel Files;DBQ={filepath}\{file.xlsx};DefaultDir={path}
DOCUMENTS;DriverId=790;MaxBufferSize=2048;PageTimeout=5;
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top