I am trying to query an Excel spreadsheet saved on SharePoint, like a database.
For some reason I am able to query the Excel spreadsheet perfectly, when it's a local spreadsheet, but not when it's on SharePoint.
I am able to use the Excel.Application
object to open the Spreadsheet from VBScript in UFT, but not when I put the SharePoint link into my connection string data source. I've tried the following:
- Changing slashes from
/
to\
and taking out white space by putting in%20
with no luck. Changing "Data Source" to "Database", including trusted connection and including username and password. Here's my connection string/code:
(Fails)
ExcelFileLocation = "http://sharepointlocation/folders/spreadsheet.xlsx"
(Works)
ExcelFileLocation = "C:\projects\spreadsheet.xlsx"
When I do these lines, it does open the spreadsheet from SharePoint, but I am trying to avoid traversing through rows / columns to find the data I want.
TemExcel.Workbooks.Open "http://sharepointlocation/folders/spreadsheet.xlsx"
TempExcel.ActiveWorkbook.SaveAs "C:\projects\Temp.xlsx"
TempExcel.Application.Quit
objConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ExcelFileLocation & ";Extended Properties=""Excel 8.0;HDR=Yes;"";"
objRecordSet.Open ExcelQuery,objConnection,adOpenStatic,adLockOptimistic,adCmdTest