Liu Su
Liu Su

Reputation: 101

read pivot table from Excel workbook using Python

I'm trying to read an .xlsm file using Python, however it contains pivot tables that cannot be read directly. I want to be able to specify all the parameters in the pivot table's filters then get the selected data. I've searched for some libraries but no result. Can anyone help me with this?

Upvotes: 1

Views: 4254

Answers (2)

ASH
ASH

Reputation: 20302

I believe you have to read in the data and then create a pivot based on that data set. See the link below for some info on how to get started.

http://pbpython.com/pandas-pivot-table-explained.html

This looks good too.

http://mourafiq.com/2016/01/01/generating-excel-report-with-python.html

So, as you can see, you need to pivot the data set yourself. I don't believe Python will interpret an Excel Pivot Table object.

Upvotes: 0

FluxIX
FluxIX

Reputation: 325

Using pandas you can make a pivot table in Python (http://pandas.pydata.org/pandas-docs/stable/generated/pandas.pivot_table.html) from a .xlsm file.

Upvotes: 1

Related Questions