create dropdown in excel using python

# Using Data-Validation 
# An example using openpyxl with DataValiation
# more on docs - https://openpyxl.readthedocs.io/en/2.5/validation.html
from openpyxl import Workbook
from openpyxl.worksheet.datavalidation import DataValidation

wb = Workbook()

ws = wb.create_sheet('New Sheet')

for number in range(1,100): #Generates 99 "ip" address in the Column A;
    ws['A{}'.format(number)].value= "192.168.1.{}".format(number)

data_val = DataValidation(type="list",formula1='=$A:$A') #You can change =$A:$A with a smaller range like =A1:A9
ws.add_data_validation(data_val)

data_val.add(ws["B1"]) #If you go to the cell B1 you will find a drop down list with all the values from the column A

wb.save('Test.xlsx')

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to create a dropdown in excel how to put drop down in excel how to use dropdown in excel how to make a dropdown in excel cell how to do a dropdown in excel excel create a drop down list how to create drop down menu excel make drop down list excel create drop down options in excel how to add drop down box in excel how to make drop-down list in excel python excel drop down list how to have drop down list in excel how to create drop down menu in excel how to add a drop down list in excel excel creating drop down list how to include drop down in excel create drop down list excel how to create a dropdown on an excel sheet how to create dropdown in excel how to create a drop down in excel how to make a dropdown in excel excel create dropdown list how to make a drop down box in excel put drop down in excel create drop down excel how to add drop down list in excel create drop down list in excel using python with pandas create a dropdown in excel how to make drop down in excel how create drop down list in excel how to create a drop down list in excel how to add a drop down in excel how to make drop down menu in excel dropdown excel how to create a drop down menu in excel make drop down list in excel how to add drop down in excel create excel spreadsheet with drop down list using python create dropdown in excel how to add dropdown in excel create a drop down in excel create drop down list in excel excel dropdown create excel with drop down list how to put the drop down in excel make a drop down list in excel create a drop down excel create an excel drop down list add dropdown in excel how to make drop down list in excel create a drop down list in excel create excel drop down list creating excel dropdown how to create drop down list in excel excel create drop down list how to make a drop down list in excel making a drop down menu in excel dropdown in excel drop down in excel excel drop down list making drop down list in excel create dropdown in excel using python
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source