|
-
Feb 14th, 2006, 09:29 AM
#1
Thread Starter
Lively Member
[RESOLVED] Query a spreadsheet?
I put together a reporting app in Excel similar to some you may have seen before. You define criteria for different rows and columns and the intersection of these rows and columns are populated with summary data from an outside database at runtime. You can drill down to the detailed data as you would with a pivot table.
The database is completely out of my control and the connection to it is less than reliable.
As a workaround to getting the detail from the DB I am replicating the relevant tables into worksheets. Size isn't an issue since the tables are never more than a few thousand lines or so. Instead or requerying the db when more detail is needed, I'd like the program to query this backup sheet. I know there are about 100 different ways to pull filtered data from a spreadsheet, but other than this piece, I'm done with the app and I'd rather not recreate the wheel.
Is there a way I can query a spreadsheet with standard SQL? The backup data will be in the open workbook calling the query. Is it necessary to create an ODBC connection to the workbook? If so, are there access issues involved since the user will always be in the workbook being queried?
-
Feb 14th, 2006, 10:29 AM
#2
Re: Query a spreadsheet?
Yes, you can use ADO and query the Excel sheet the same as a database table. I have some code on the forums already so a search should bring them up. You can also check http://www.connectionstrings.com for the conn string needed.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 14th, 2006, 01:26 PM
#3
Thread Starter
Lively Member
Re: Query a spreadsheet?
Wow.. this forum is littered with answers. I guess searching for ADO instead of DAO would have helped. Thanks.
For anyone waiting with baited breath...
http://www.vbforums.com/showthread.p...DO+excel+sheet
-
Feb 14th, 2006, 01:29 PM
#4
-
Feb 14th, 2006, 01:29 PM
#5
Re: [RESOLVED] Query a spreadsheet?
"Littered" lol I would say "populated with valuable information".
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|