0

I read through the question here, but did not see a solution for my case.

I've created a basic program that is opening and using data located in an .xslx file but I always receive the "UserWarning: Discarded range with reserved name" when running. I don't understand what this means, nor how to avoid the error. I don't want to bypass the error... I want to fix the code so that it isn't thrown.

Here's my code:

from openpyxl import Workbook
from openpyxl import load_workbook

def get_unique_vulns(worksheet):
    crit_vulns = worksheet.cell(row=4,column=2).value
    high_vulns = worksheet.cell(row=5,column=2).value
    med_vulns = worksheet.cell(row=6,column=2).value
    low_vulns = worksheet.cell(row=7,column=2).value
    list_vulns = (crit_vulns, high_vulns, med_vulns, low_vulns)
    return list_vulns

workbook = load_workbook('test.xlsx', data_only=True)

vuln = {}
month = "May"
summarySheet = workbook.active
vuln[month] = get_unique_vulns(summarySheet)

print (vuln)
Community
  • 1
  • 1
user987654321
  • 303
  • 6
  • 17

1 Answers1

5

It's a warning not an error. There is nothing to fix but you can tell Python to repress all warnings.

Charlie Clark
  • 18,477
  • 4
  • 49
  • 55