So this is my first time that I'm attempting to read from an Excel file and I'm trying to do so with the openpyxl module. My aim is to collate a dictionary with a nested list as its value. However, when I get this warning when I try to run it:
UserWarning: Data Validation extension is not supported and will be removed warn(msg)
I don't know where I'm going wrong. Any help would be much appreciated. Thanks
import openpyxl
try:
wb = openpyxl.load_workbook("Grantfundme Master London.xlsx")
except FileNotFoundError:
print("File could not be found.")
sheet = wb["FUNDS"]
database = {}
for i in range(250):#this is the number of keys I want in my dictionary so loop through rows
charity = sheet.cell(row=i + 1, column=1).value
area_of_work = []
org = []
funding = sheet.cell(row=i + 1, column=14).value
for x in range(8, 13): # this loops through columns with info I need
if sheet.cell(row=i +1, column=x).value !="":
area_of_work.append(sheet.cell(row=i +1, column=x).value)
for y in range(3, 6): # another column loop
if sheet.cell(row=i +1, column=y).value !="":
org.append(sheet.cell(row=i +1, column=y).value)
database[charity] = [area_of_work,org, funding]
try:
f = open("database.txt", "w")
f.close()
except IOError:
print("Ooops. It hasn't written to the file")
For those asking here is a screenshot of the exception: (
Excel has a feature called Data Validation (in the Data Tools section of the Data tab in my version) where you can pick from a list of rules to limit the type of data that can be entered in a cell. This is sometimes used to create dropdown lists in Excel. This warning is telling you that this feature is not supported by openpyxl, and those rules will not be enforced. If you want the warning to go away, you can click on the Data Validation icon in Excel, then click the Clear All button to remove all data validation rules and save your workbook.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With