Trying to write a Google apps-script to show details from a pivot table in google sheets.
In vba I would loop through the range of values in the pivot table and use Range(XYZ).ShowDetail = True to create separate sheets of the underlying data - I can right click each value in a pivot in google sheets and select Show Details - I want this done via script.
Any help is much appreciated.
Currently, there doesn't seem to be a equivalent way to create sheets from pivot table programmatically. Consider creating a feature request in the issue tracker
Related
There is a worksheet with cross tables for each questions.
Now what I am looking for is that if I put a list of questions in a list type drop down and use it to call the entire data only for that particular from another worksheet.
How can I do this?
I tried looking for the question using Vlookup in the entire sheet and it was able to look for that question and bring it back.
Now when I tried using another Vlookup to go inside the table it failed.
I'm trying to insert a manual column in between a Big Query generated extract columns via Connected Sheet. Basically, I already have a Google Connected Sheet which is pulling from Big Query via SQL. Whenever I try to insert a manual column in between columns generated by the query though, it automatically moves the manual column to the very end on the right or to the very end on the left. I don't want this. I want to be able to insert a manual column in between a Big Query generated column in a Google Sheet.
Is it not possible to do this? Or is there another way to be able to pull something like this off? I can't find any videos or specific documentation on if it's possible.
See below answer to questions:
Is it not possible to do this?
As per this documentation:
Direct access to BigQuery datasets and tables is still controlled within BigQuery. A user with Sheets-only access can perform analysis in the sheet and use other Sheets features, but the user will not be able to perform the following actions:
Manually refresh the BigQuery data in the sheet.
Schedule a refresh of the data in the sheet.
Hence, you cannot manually create a column when you use Connected Sheets when accessing Bigquery Data. The main function of Connected sheets in this use case is to analyze and visualize data from Bigquery, and not to manipulate data.
Is there another way to be able to pull something like this off?
Option 1: extract from Sheets the data from Bigquery
Then you can see that the Insert function is enabled. You may insert another column in this extracted sheet:
Option 2: Download the sheet as an excel file and insert column in between once downloaded:
Would you please help me (total beginner) to prepare a VBA macro that would open a sheet on the background and import specific selection as shown below:
Let's say we have downloaded wordcount analysis (xlsx) like this downloaded from a CAT tool for testing.
Now I would need to add a macro to my main sheet that would read lines starting (Column A) with "All". If "All" then I'd need to record columns of that line (specficilly Columns A - O) in array / hashtable?.
Please take a look at this image that summs it all (better than explaining it for me :-)
Let me know in case you need to know more details.
All tips / suggestions are greatly appreciated.
Many thanks!
My suggestion (I'm a beginner too) would be to use the Macro Recorder. Great tool to learn (example).
start recording
filter for 'ALL'
copy/past the Cells
stop Recording
Then have a look at the recorded code and adjust it :)
Looking at your data and the final layout you are looking for, using a Pivot Table would provide you with all of the flexibility you need.
You can:
filter which data to display
generate calculated values based on data in other columns
choose what order your columns are displayed
dynamically change the layout if you decide you want a different view
From your data, I was able to generate the following Pivot Table in about 15 minutes.
There are several good, simple tutorials on building Pivot Tables. A Google search will turn up plenty.
Things you will need to learn about for your particular problem:
Classic display (I used the classic display to get this particular layout)
Calculated Fields (many of the columns in the pivot table are calculated based on your spec). There is a maximum string length of 255 characters for a field calculation, so you may need to rename some of the columns in the original data set.
Of course, basics of Pivot Tables
Loading new data and updating your pivot table
Good Luck!
I have multiple web query tables in an Excel spreadsheet and I can refer to them in vba using QueryTable(1), QueryTable(2), etc.
I have some vba code that is used to refresh one of these tables, please see below. However, the problem is that every time I create a new web query table, the table's QueryTable number changes (i.e., n keeps changing for QueryTable(n) for a selected table). Is there a better way to refer to a specific web query table other than referring it as QueryTable(1)? Thanks.
main_workbook.Worksheets("Input ID").QueryTables(1).Refresh (False)
Maybe...
For i = 1 To main_workbook.Worksheets("Input ID").QueryTables.Count Step 1
main_workbook.Worksheets("Input ID").QueryTables(i).Refresh (False)
Next i
Pretty much what the title says. Is it possible to show the MDX that is sent to OLAP source when using a pivot table in Excel 2007?
You can download the OLAP Pivot Table Extensions from the codeplex site( http://olappivottableextend.codeplex.com/)
Install it.
You can then right click and see the OLAP query.
Regards,
Ambarish
I was curious to see the MDX generated by a pivot table in Excel also. Apart from imputing MDX manually I couldn't see a way to see the MDX after a user has selected and filtered etc.. on the pivot table itself.
But I found a quick vba snippet here
PivotTable.MDX
All I did was ALT + F11 to bring up the VBA window
Insert a userform like so
Click inside the textbox inside the userform and change these two settings in the properties window
Multiline - True
Wordwrap - True
Paste in the code below
Sub CheckMDX()
Dim pvtTable As PivotTable
Set pvtTable = ActiveSheet.PivotTables(1)
UserForm.TextBox.Value = pvtTable.MDX
UserForm.Show
End Sub
Make sure your Pivot Table is the active sheet (i.e have the worksheet open on the pivot table clicked in a cell).
Press the run button and a userform should pop up like so where you can copy out the MDX text.
This was on Excel 365. Hope this helps.
If you have profiler you could set up an Analysis Services trace and catch it on the way, or do you need to see it without executing it?
While the OLAP Pivot Table Extensions are still available for Excel 2013, you can no longer right-click on the table and view the MDX. This is yet another example of MIcrosoft going out of their way to make life more difficult for end-users and developers. The ability to view MDX for the current PivotTable selections should be built into Excel. It's not because Microsoft's developers either were too careless to give such a critical thing priority or because the powers that be saw a potential for an add-on product. Regardless, it's an example of why they are often hated. Over the years I can't even count all the hours of life I've lost outside the normal workday because the incompetent or malevolent behavior of Microsoft's manager, developers... But what other toolset can do what Excel and SSAS do? It's not an easy thing to replace so we have to deal with their crippled tools.
There is a free web based pivot table tool called WebPivotTable which can connect to SSAS cube directly and display each MDX statement for teh current PivotTable selections. It has all functions as Excel but with more intuitive user interface. In MDX windows, you can even test your own MDX statement and get results displayed in table and charts.
Here is Demo and Documents.