Link Data Models to multiple files - powerpivot

I created a file that imports multiple tables, and then I do several modifications and calculations with Power Pivot. The problem is that I want to use the final results, not only in that current workbook, but also in other workbooks.
So my question is, is there a way to link other excel files to that data model that I created and worked on?
Please note the data changes every day, so I am looking for a permanent connection.
Appreciate any help here.

if I understand you correctly you would like to access the PowerPivot model/measures that you have created in one xls file from within other xls files.
If so, the "core" vs. "thin" workbook approach might be what you are looking for. This approach works with Excel 2010 but not with Excel 2013 however and you will need a Sharepoint Server with PowerPivot for this to work.
The approach is described in Rob Collie's awesome PowerPivot blog:
http://www.powerpivotpro.com/2011/02/powerpivot-scheduled-refresh-pt-3-thin-workbooks/
and here:
https://pivotstreamllc.zendesk.com/hc/en-us/articles/201148566-Splitting-Workbooks-into-Core-Thin-Pairs

another option is to load all your data source in one Master workbook, then write back the result in the same workbook using Reverse Linked Tables.
Now you can use that Master workbook as your backend for all your reports.
or use PowerBI Desktop as your backend, officially it is not support but Excel can have a local connection to PowerBI desktop.
I put more details here
https://datamonkeysite.com/2016/11/13/thin-and-core-workbook-without-sharepoint-or-ssas/

Related

Excel Query Versioning

Scenario - I have embedded a query into an excel workbook and distributed it to say 10 people in my company. This workbook can also be found on a shared drive and is considered the master workbook. Each of the 10 people make a, save as, copy with their own filters etc etc. They can refresh the query as needed and everyone is happy. 2 months later, something changes in our tables and I need to update the query with additional code. I can do so in the saved workbook on the shared drive but now all the 10 users copied versions of excel are still utilizing the old code.
How can I make their versions dependent on any changes to the embedded query in the "master" copy of the workbook? Is this even possible? If not and considering that embedded queries in excel are a company requirement, what is the best way to solve the problem I have described above? We have SSRS but management wants to move away from that and prefers excel reporting.

Import external .txt table to PowerPivot using VBA?

I'd like to import some .txt tables to PowerPivot without clicking "From Other Sources" --> "Text File", but rather by running a VBA macro.
The idea is that there are several .txt tables, say
C:\Table1.txt
C:\Table2.txt
C:\Table3.txt
etc.
and to create a user form or similar so that a user can select which tables he needs, then VBA creates a single appended table in PowerPivot of the ones selected. I'd know how to do that if not for two parts:
1) How to import a table to PowerPivot from an external source (C:\) using a VBA command?
2) How to "append" those tables into one through VBA such that they wouldn't appear as different tables in PowerPivot, but rather as one table with always the same name?
I can find tangent questions and information, but no working examples of how to automate importing tables from external .txt sources (or .csv or .accdb for that matter) into a single PowerPivot table like this...
Thank you very much!
Power Query allows a GUI driven interface to do exactly what you want without VBA. You may want to consider that took instead, as it interfaces natively with Power Pivot and can be embedded in a hosted workbook, whereas the VBA solution could never work on SharePoint or Power BI.

Exporting Excel files from SAP with pivot tables

I currently have a report which will be emailed to business users weekly. The data output can only be csv/xml and I do not have the ability to automatically add the requested pivot tables; therefore, I am attempting to pull the data with a Workbook_Open sub routine in an Excel file I will have premade. My issue here is I cannot use Macros on SharePoint nor can the Data be publicly accessed in a Macro...so I feel like I am up a creek.
Any suggestions from a VBA, Excel, or BEX/BOBJ standpoint?
Well if your report is forced to be csv/xml.... and you can't access the data directly through a macro... the solution is not terribly straight forward.
Here is how I would solve
1) SAP Job drops off file
2) Some type of automation kicks off a macro
3) Macro formats and emails report
probably possible to have sap email a spreadsheet formatted to taste directly via abap code.... that is not something i have much experience with.

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.

Writing data back to SQL from Excel sheet

I know it is possible to get data from a SQL database into an excel sheet, but i'm looking for a way to make it possible to edit the data in excel, and after editing, writing it back to the SQL database.
It appears this is not a function in excel, and google didn't come up with much usefull.
If you want to have the Excel file do all of the work (retrieve from DB; manipulate; update DB) then you could look at ActiveX Data Objects (ADO). You can get an overview at:
http://msdn.microsoft.com/en-us/library/ms680928(VS.85).aspx
You want the Import/Export wizard in SQL Management Studio. Depending on which version of SQL Server you are using, open SSMS (connect to the SQL instance you desire), right click on the database you want to import into and select Tasks.. "Import Data".
In the wizard, click Next (past the intro screen) and from the Data Source drop list select "Microsoft Excel". You specify the path and file name of the Excel spreadsheet, whether you have column headings or not.. then press Next. Just follow the wizard through, it'll set up the destination (can be SQL Server or another destination) etc.
There is help available for this process in SQL Server Books Online and more (a walkthrough) from MSDN.
If you need something deployable/more robust (or less wizard driven) then you'd need to take a look at SQL Server Integration Services (for a more "Enterprise" and security conscious approach). It's probably overkill for what you want to accomplish though.
There is a new Excel plug-in named "MySQL for Excel" : http://www.mysql.com/why-mysql/windows/
I just had a need to do this, and this thread has been quiet for a long time, so I thought it might be useful to supply a recent data point.
In my application roving salespeople use a copy of an Excel workbook that tracks the progress of a prospect through a loan application. The current stage of the application needs to be automatically saved back to a remote SQL database so that we can run reporting on it.
Rejected methods for updating the database from Excel:
SSIS and OpenRowSet are both methods for allowing SQL Server to pull the data from Excel, and don't work very well when the Excel workbook is sitting in an undefined location on a user's computer, and certainly not when the workbook is currently open in Excel.
ADO is now, if not actually deprecated, nevertheless looking very long in the tooth. Also, I wanted the solution to be robust in the face of the user possibly not being connected to the internet.
I also considered running a web API on the destination server. Macros in the Excel workbook connect to the web API to transfer data. However, it can sometimes be painful to allow a web API to talk to the outside world. Also, the code to make it robust in the face of temporary loss of internet connection is painful.
The adopted solution:
The solution I plan to adopt is low-tech: email. Excel emails the data to an address hosted on an Exchange server. Everyone in the company has Outlook installed, so the emails are sent by programmatically adding them to the Outlook Outbox. Outlook nicely handles the case when the user is offline. At the server end, a custom C# executable, fired up at regular intervals by the Task Scheduler, polls the inbox and processes the emails.
You could use try these add-ins :
www.QueryCell.com (I created this one)
www.SQLDrill.com
www.Excel-DB.net
You can use the OPENROWSET function to manipulate Excel data from a T-SQL script. Example usage would be:
UPDATE OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;DATABASE=c:\MySpreadsheet.xls',
'Select * from MyTable')
SET Field1='Value1' WHERE Field2 = 'Value2'