Running SQL on Excel like Query on Google Sheets - sql

I have a large database on Microsoft Excel 2010 on which I want to run SQL queries like the =QUERY formula in Google Sheets.
Basically on Google Sheets, the =QUERY can reference cells which take user input. This allows me to dynamically update the table based on the user input fed into the =QUERY. I've created a Google Sheet exemplifying what I mean here (please change cell G3 only) - the only difference between this and the final product would be that the complete table is in a sheet and the dynamically updated one is in another.
I've created a connection in Data Wizard in Excel but it doesn't seem like I'd be able to take user input running queries from there. Also, I've found similar questions here but neither provided an answer to this question specifically.
I want to do the exact same thing on Excel - being I do not want to use VBA, Filters, etc. I want precisely this. Is there a way to do this?
EDIT: I've tried Advanced Filters but they don't respond dynamically to different user input: you input once, it gives you the result, you go back and change parameters and it doesn't change it again.

You can use POWER QUERY for Excel, Info, Download.

Related

MS Access reports issue?

I have an already existing report that runs off a particular query. This report runs perfectly. I was having an issue with one of the CLIENTs for the report, where I had to change a small piece of information. This required me to run some VBA code and insert all the info into a temp table. I'd like to run the same exact report, however, instead of using a query, to use the tempInfo table. Is there a way for me to do that? it's okay if I create another report, but the first report is somewhat complicated - so it would save a lot of time if I could just copy and paste at least the GROUP, SORT TOTAL so my data is displayed correctly. ANy suggestions?
Copy the report that you are wanting to use and paste it in the navigation menu to create a copy of it.
To use the "Temp Table" in your report, just go into design view of the newly copied report and change the Record Source to your "Temp Table."
You may also need to change the control source of any textboxes, labels, etc..

Can Powerpivot be used to present data without pivoting it?

This isn't a coding question, so much as it is a functionality question.
I'm a bit new to Powerpivot and I'm attempting to use Powerpivot as a way to deliver reports to my team rather than SSRS because in our company, the only SSRS ReportServer I can use is officially "owned" by a team that is hostile to my team.
I have written numerous SQL ad-hoc queries that we are using for reports in SSRS, but been I've trying to migrate them to Powerpivot. For some of the reports, I've been able to paste the SQL query into the powerpivot window and make a pivottable out of these. However, I'd like to be able have some workbooks just contain the results of the query (they don't deal with numbers, as some of them are a data dump or a large collection of text strings), so that they look like the powerpivot window's dataset, but that they can be filtered, sorted, etc. Is this possible, or can I only use pivottables? I can't seem to find a way that I can just get Excel to directly display what is in the Powerpivot window without pivoting it - I know it is called Power*pivot* but because the PP window just shows the query results itself, I'm hoping there is a way to use it as an alternative to SSRS.
Also is there anyway to check if our Sharepoint server is capable of running Powerpivot so that I can deploy reports there for users to use without having Powerpivot installed on their computers other than by saving it to Sharepoint and seeing if a user can run it? If not, how difficult would it be to have an IT team update the SP server so that it can handle PP?
Any help is appreciated, as I'm in a position where I cannot contact IT or project management, and I can't raise any red flags with IT/BI/PM. Thank you very much for your time.
It sounds like you just want to get the results of your SQL query directly into an Excel spreadsheet, where you can use the Excel filter and sort capability. It doesn't appear that you want to use any of the functionality that PowerPivot provides, so you can achieve what you described by using an existing Excel component, Microsoft Query. It's a bit of a clunky old interface but it works. Here's some instructions to use:
In an Excel spreadsheet, click on the Data tab, select the "From Other Sources" button on the Get External Data area of the ribbon.
Select "From Microsoft Query"
On the "Choose Data Source" click OK to create a new data source
On the "Create new data source" window select the appropriate driver and database details for your data source
If using a SQL Server data source, don't select anything for the optional step 4 (select a default table).
Click OK to return to the Choose Data Source window, then OK again to select the new data source.
You're now prompted to choose columns for your query, but if you already have some SQL then click Cancel - this will display a prompt to continue editing in Microsoft Query - click Yes.
The Add Tables window pops up, click Close
You're now in the Microsoft Query interface. If you click on the SQL button, you can paste in your SQL. Click the Return Data button to run the query, the results will be displayed in an Excel worksheet.
Once this is set up, you just need to click "Refresh Data" on the Data tab to re-run the query and update the spreadsheet.

Exandable table in Microsoft Word form

I'm creating a form in Microsoft Word that will be distributed to various people. One section on the form is a table where the user lists all the tests that he/she has taken and some relevant details about those tests. I don't know in advance how many tests a user has taken, although I can assume it is at least 1. I'd like to create a table that the user can add rows to for each test. Some of the columns will have form controls, one has a drop box, one has check boxes, one has a date picker. I'd like to be able to link these forms with Access once the user has completed them.
Is it possible to create a user expandable table that maintains the form controls in each column?
I am on a Linux machine right now so I can't test and debug code for you, but I have made tables in Word before where the size is decided at runtime (in fact, I did it from Excel, but that is off topic). However, I can tell you the general form is:
expression.Add(BeforeRow)
where expression returns a rows object, such as
ActiveDocument.Tables(1).Rows.Add(5)
Please see microsoft documentation of dealing with
tables:
http://msdn.microsoft.com/en-us/library/office/aa212430%28v=office.11%29.aspx
and rows:
http://msdn.microsoft.com/en-us/library/office/aa223081%28v=office.11%29.aspx
Also, from the VB editor in word, go to help and search "table object members," "row object members," etc.
If this hasn't been closed by tomorrow I will write something up. I will admit, in my experience Word VBA is a bit more temperamental than Excel VBA.

How to extract data from a database and populate a sheet in Excel

I am storing data in a backend database (PostgreSQL) which is running on a Linux machine. I want to be able to fetch data from the database, and populate a sheet in an excel workbook, so that I can carry out analysis in Excel.
It has been quite a while since I wrote anything in VBA, so I would appreciate some help (or links) in getting started. I would like to know the best way to approach this:
Pure VBA solution OR
Mixture of C# or other .Net language for data extraction logic and VBA for manipulating Excel objects (sheet data population etc)
Any ideas, tips, snippets and/or links that can help me get started on the twin objectives:
fetching data from a backend database (PostgreSQL) into Excel
populating a specified sheet in Excel with the columnar data retreived from the database
will be much appreciated.
If you are just trying to import data, Excel can do that without additional code. Just set up your windows client to connect to your postgreSQL server thru ODBC. (Here's one way guide to setting that part up: enter link description here
Then in Excel (Use a modern version, like 2007 or greater) from the "Data" tab, click on "Existing Connections" to connect to the ODBC connection you set up and pick the tables/data to import into excel. Once the spreadsheet has loaded the data, you can just click the "Refresh All" button to update the data.

Generate Reports from Ms Access 2007 Using Queries automatically via VBA

I have a few queries which need to be exported into a report and I want this to be done automatically each time the database is opened. I'm guessing this would be possible using VBA to which i dont have much knowledge off.
Can anyone help with this please?
Thank You
The easiest way would be to build a report based on the queries and add an Autoexec macro to the database to print the report.
EDIT
Choose Create Macro, select Open Report as the Action, select the report name from the dropdown list, save the macro as AutoExec.
Maybe I'm missing something in your question but it sounds like you just need to base the report's record source on the SQL and don't need VBA. Copy and paste the SQL directly into the report record source. Every time you open the report it will automatically pull the most recent data.