0

I struggle with setting the data validation in my Google spreadsheet document using pygsheets. I found this function:

wks.set_data_validation((startIndex, wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]), condition_type='ONE_OF_RANGE', condition_values='=CONFIG!E3:E')

# wks is my current worksheet
# startIndex is the cell to start
# wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]) should be the same column as in startIndex, but does not work (it works with set_dataframe though) - I will take care of this later
# condition_type='ONE_OF_RANGE' should define a range of values
# condition_values='=CONFIG!E3:E' is the range of value in the same document

Calling this throws a 400 error with the text:

returned "Invalid requests[0].setDataValidation: ConditionType 'ONE_OF_RANGE' requires exactly one ConditionValue, but 12 values were supplied.". Details: "Invalid requests[0].setDataValidation: ConditionType 'ONE_OF_RANGE' requires exactly one ConditionValue, but 12 values were supplied."

Can somebody help with this?

Best regards, Manuel

MTrykar
  • 3
  • 3

1 Answers1

0

from docs, the condition_values should be a list. try this

wks.set_data_validation((startIndex, wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]), condition_type='ONE_OF_RANGE', condition_values=['=CONFIG!E3:E'])
Nithin
  • 5,470
  • 37
  • 44