Unhide columns in an Excel sheet with pandas and output into a dataframe

Viewed 103

I am having an excel workbook with a sheet containing some pivoted data. Since the data is in a tabular format, I am able to read it into a dataframe. However, the pandas.read_excel() is able to read only those columns that are present in the pivot table. I would also want to read/unhide/select the columns that are no part of the pivot table yet. Is there a way by which I can do this in pandas or any utility in Python? Also,can the pywin32 utility can help me here?

pandas.melt() doesn't seem to be able to help here. Attaching a snip below.

Edit1: The source data is not available as a separate sheet in the workbook. I am planning to request for the same if there isn't any other way.

enter image description here

2 Answers

I'd suggest importing the source data (ie the source range for the pivot) and doing the pivot and aggregations in pandas so you have access to full data set that you need.

not enough rep to comment ; is the source data of the pivot contained in the same workbook? i would read that instead.

Related