Question: I have this array :

```
defaultColumnsWithItems = [
{
  column: 'Contrie', items: [
  { id: 1, label: 'USA', selectedItem: true },
  { id: 2, label: 'FRANCE', selectedItem: false  },
  { id: 2, label: 'MAROC', selectedItem: false  }
  ]
},
{
  column: 'Categorie', items:
    [
      { id: 0, label: 'Alimentaion', selectedItem: true },
      { id: 1, label: 'ricolage', selectedItem: false },
      { id: 2, label: 'Literie', selectedItem: true },
      { id: 3, label: 'Menage', selectedItem: false },
    ]
}

```

];

I want to filter only the elements with selected item withe value equal to true.
I try this:

```
const columnsWithSelectedItems = colmunsWithItemsToFilter.filter((columnWithItems) => {
    return columnWithItems.items.filter( item => item.selectedItem === true)
  })

```

but it return all elements.

Thank you.

Answer: 
You'll want to use the pandas library within python. It has a function called `pandas.read_excel` that is very useful for reading excel files. This will return a dataframe, which will allow you to use `iloc` or other methods of accessing the values in the first and second columns. From there, I'd recommend using `os.rename(old_name, new_name)`, where old\_name and new\_name are the paths to where your .pdf files are kept. A full example of the renaming part looks like this:

```
import os

# Absolute path of a file
old_name = r"E:\demos\files\reports\details.txt"
new_name = r"E:\demos\files\reports\new_details.txt"

# Renaming the file
os.rename(old_name, new_name)

```

I've purposely left out a full explanation because you simply asked if it is possible to achieve your task, so hopefully this points you in the right direction! I'd recommend asking questions with specific reproducible code in the future, in accordance with [stackoverflow guidelines](https://stackoverflow.com/help/how-to-ask).
I would encourage you to do this with a .csv file instead of a xls, as is a much easier format (requires 0 formatting of borders, colors, etc.).

You can use the os.listdir() function to list all files and folders in a certain directory. Check os built-in library docs for that. Then grab the string name of each file, remove the .pdf, and read your .csv file with the names and values, and the rename the file.

All the utilities needed are built-in python. Most are the os lib, other are just from csv lib and normal opening of files:

```
with open(filename) as f:
    #anything you have to do with the file here
    #you may need to specify what permits are you opening the file with in the open function

```