pythonexcelpython-in-excel

Read data from sheet1 and output filtered data on sheet2


Is it possible? Or it seems that each sheet is a separate environment?

CONTEXT: A clean way to read 200 rows of data (and 30+ columns) is using something like

df=xl("A:BS", headers=True)

So a user wants a filtered view of my data on sheet2. e.g., df[df['project'] =='bench']

(and despite that one can use Excel filter but prefers not to.

E.g., rewrite in python-in-excel R markdown logic that parses input from excel as html page with 30+ analyses and TOC and graphs and headings)


Solution

  • You can do something like

    import pandas as pd
    df = Excel("Data!A:AD", headers=True)
    filtered_df = df[df['project'] == 'bench']
    filtered_df