MS Excel - Pivot Table - Accessing the source data when it isn't a tab in the spreadsheet - excel

I have a spreadsheet that is emailed to me by an outside vender. It contains a bunch of pivot tables. I really couldn't care less about the pivot tables, I just want the underlying data. The data comes from a sql server that I don't have access to, but the data is stored within the spreadsheet. Is there anyway that I can access the data, (I think it's the PivotCache) directly without drilling into one of the pivot tables?
I'd love some sort of ODBC/ADO.Net command that I can use from SSIS. But am open to just about anything that doens't require me to open and save the workbook.
I'd also like to avoid macros if at all possible.

Here's the answer. Or at least what I did to resolve my problem.
There is really no way to accss the underlying PivotCache data except via pivot tables. So direct accss was out. I ended up using a script task with excel ole to dynamically create a pivot table with the data I needed at run time. Once the script task is done, I then use the new pivot table as my dataflow source. Excel can be a little tricky to automate, but it's worth it.

Related

Excel PowerPivot - change data source type

I have an Excel 2016 with 30 graphs based on PowerPivot. PowerPivot fetches the data from another Excel sheet, but I want it to get the data from a SQL server table instead.
How can I change the data source type in PowerPivot? I've tried looking in the Excel xml without any luck. Would be a lot of work re-creating all graphs over again just to switch data source
Thanks
Dennis
One suggestion I would make for the future, if all the users are using 2016 is to use Power Query which comes standard with that version of excel. In the Power Query loading data into Power Pivot scenario, all Power Pivot cares about is the column names. This means that the query can be changed between data source types without causing issues, as long as the same column names are changed.
As an example, I have one file that based on a parameter flag rips data out of a series of excel files on a shared network drive or Share Point. Both of which would be different data sources. The first opening a folder as the data source, then excel files listed within the folder. The other opening a share point list as its data source, then navigating though excel files.

Link to pivot table from another excel file

Banging my head against the wall on this one and every option I try has a problem with what i am trying to achieve.
So I have a pivot table in excel that is connected to a database. What I want to be able to do is have a link in another excel sheet to that pivot table, so that it picks up any changes to it in terms of data. The reason I am doing this is because I am putting the excel file up on sharepoint, but if a user downloads it, it retains the connection to the SQL Database, and because they are not authenticated, it doesn't refresh. I need them to be able to do this because it will allow them to customise their pivot table as needed, and it will retain that when they next open it. But the original pivot table, connected to the datasource, won't be affected.
I have tried:
Copying Pivot Table: I have copied the pivot table and pasted it in a new excel file, and this retains the connection to the SQL Database so doesn't work.
Moving Worksheet: I have tried moving the whole worksheet to a new excel file and this does again retains the link to the SQL Database.
Creating connection to excel file: This connected to the excel file, but the pivot table is lost and it simply shows the data in standard excel format.
Slicers: I have looked at slicers but this won't work either, because it means if he makes a change it is reflected in the original pivot table.
Sharepoint: I have looked at excel services on sharepoint. Although I can get him to view the data on the online excel, again, if he downloads it it loses the connection.
I guess I could change the authentication settings on SQLServer so that rather than using windows authentication I create a password and then that password is retained as I copy the file. Because this would only allow access to the view in the SQL Database this would prevent any detrimental activity. However, what I would really like to do is just give a copy of the excel file that connects to the original pivot table (so that when this updates this data is reflected in the copy on refresh), but any changes in the copy (i.e. formatting etc) only affect the copy.
If anyone knows how to do this I would be most appreciative of your help.
I may said something incorrect here, so pardon my lack of knowledge, but with the option:
Creating connection to excel file: This connected to the excel file, but the pivot table is lost and it simply shows the data in
standard excel format.
If I understand correctly, Creating connection to excel file provides a copy of the database in an excel file with all the source data from the original pivottable, and if by "connected to the excel file" you mean that any changes to the original pivottable is updated in this connected file in the copy of the database.
Then adding a replica of the pivottable in this connected excel file pointing to the copy of the data would not solve the problem?
Am I missing something?

Has anyone achieved to use ODBC connection from Excel file into Powerpivot?

I have installed Powerpivot for Excel 2010. I don't have Access 2010 so I thought could I arrange the data in the similar manner as I would for a database.
I'm wanting to query an excel file that has rows of self-generated data into Powerpivot in order to perform simple pivot table. In a sense attempt to get an overview of information about a data set.
At the moment, I'm unable to get set up correctly the ODBC I'm hoping I need to accept an Excel file and to get PowerPivot to accept a database from an Excel file.
Edit: I come to understand that I need to set up a table correctly in Excel so that the ODBC works correctly. Does the picture I provided be right manner to set up a table or any other manner?
Has anyone attempted to do this and if so what would the steps be?
Thanks,
Peter.
Peter, I am working on the basis that your data is in a recognizable table on a worksheet (and that you are not interested in using the standard Excel import method through 'From Other Sources')
If you create the connection to the Excel file in a very particular way it is possible to then query it as if it were a database.
Create a Connection to the spreadsheet in question in Excel through Data>Connections>Add.
In the PowerPivot window on the Design tab click on existing connections and find the connection you just created. Select the connection and Open.
You need to name the connection and then you will be offered the normal import options. Select the sheet you want to get the table from (its actually not important which one you choose at this point).
Once the table has been imported you can re-enter the setup through the 'table properties' on the design tab and you will now be able to 'Switch to' the query editor at which point you can not only write SQL to query your DB but reference any other .xlsx you like.
Jacob
the easiest way is to use a linked table from the excel sheet which has the data - is there any reason why you have not considered this as an option?

VBA as data source for Excel

I would like to have VBA generate some data for an Excel Pivot table. VBA will then recalulate the data and the pivot will update based on that.
Question: Is it possible to have VBA be a direct data source for the pivot or do I need to write down in a file from VBA and have the pitot refresh itself from there?
The direct data source gives me the advantage that I can create multi-dimensional data and not only a 2D matrix.
I can see I can choose a lot of data sources and I could write some data in one of these formats from VBA.
So for example I could choose to generate an xml file from VBA, and then have a pivot table use that xml file as its source. I guess it would be a bad idea to emulate the OLAP cubes from the SQL Server in VBA!
Damian
For OLAP cubes, the Microsoft Excel is a very good viewer, but if you have access to Analysis Server tool, you will prefer use it.
But, Excel can connect to SQL Server by itself. Have you tried? It is in Data menu.

Generating an Excel spreadsheet with a Pivot Table over a large embedded data source?

I have a large amount of data that is possibly more than a million rows. I want to be able to offer users the ability to download an Excel spreadsheet with a Pivot Table over this data, disconnected from any database.
Is it possible to have the data source that the pivot table works over embedded in a spreadsheet?
The answer to your direct question is YES, data can be embedded in a PivotTable. Yet since you specify "more than a million rows" and "disconnected from any database", the answer to the implied application is NO. You aren't going to get more than one million rows in an Excel spreadsheet. And I would venture to say that one million rows don't belong in a spreadsheet.
I think one of the purposes of a PivotTable is to allow you to summarize data from an external source. If you can (or think you can) combine data with a PivotTable and download the entire mess, why not do the summary yourself, and download just the summary data? it would be interesting to hear more about the actual application.
If you create a pivot table from an external data source, then email it to someone, they can see and interact with your pivot table. They can't refresh unless they have access to the original data. But that seems to be almost what you're asking.
Excel creates a PivotCache that is embedded in the workbook. That's why the aforementioned emailed spreadsheet can be seen by people without the source data. The PivotCache doesn't necessarily hold the source data in its entirety and it's not directly accessible (as far as I know).
I'm not sure if that answers your question. It seems like what you're after is what PivotTables do normally.
A tool that should be mentioned more when trying to work with more than a million rows in Excel is:
* PowerPivot for Microsoft Excel 2010
or www.powerpivot.com by Microsoft.

Resources