Question: The following prompt should allow the user to make a selection based on the populated list that is outputted to an array, then prints the list with its index, and asks user to select a number from the list, then sets it to a variable. Only one choice is allowed, if user specifies an incorrect option, the script will prompt to select a correct number.

```
Multiple devices detected, please select one from the list:
1. Device1
2. Device2
3. Device3

1
You have selected device Device1

```

The code below is not functional and has many syntax errors, first I would like the script to detect if the output of `arr=($(ip ad|awk '/state UP/ {print $2}'))` contains multiple entries, if so run the script, otherwise set a default value.
The case statement is not dynamic however, if more then 2 cases like below it will fail, perhaps a loop?

```
host_interfaces()
{
   arr=($(ip ad|awk '/state UP/ {print $2}'))
   echo "Multiple devices detected, please select one from the list:"
   for i in "${!arr[@]}"; do
   printf "%s%s\n" "$i.  " "${arr[$i]}"
   done
   PS3='Please enter your choice: '
   select opt in "${arr[@]}"
   do
      case $opt in
            "$opt")
               echo "You have selected device $opt"
               export HOST_INTERFACE=$opt
               ;;
            *) echo "invalid option
               break
               ;;
      esac
   done
}

```

Answer: 
Try installing odfpy

```
pip install odfpy

```

<https://pypi.org/project/odfpy/>
As suggested by @navyad

```
!pip install odfpy

```

Also, make sure you **do not** write `engine='odfpy'` instead of `engine='odf'`

```
import pandas as pd
df = pd.DataFrame(data, columns=COLS, index=None)
with pd.ExcelWriter('new.ods', engine="odf") as doc:
    df.to_excel(doc, sheet_name="Sheet1")

```