I am trying to understand how to construct an AddFilterViewRequest
in the Google Sheets API. However, there don't seem to be any good examples that I can locate in any programming language which demonstrate how it is used.
Specifically, I am trying to understand the FilterCriteria
object, and what I need to set hiddenValues
and condition
to.
In my application I am trying to construct a filter that will only show the rows where the cell in the column I have selected is not empty. I can do this manually in the Google Sheets editor, and I want to replicate the same settings in my program.
This is the code as it stands...
Request request = new Request();
request.AddFilterView = new AddFilterViewRequest();
request.AddFilterView.Filter = new FilterView();
request.AddFilterView.Filter.FilterViewId = 0;
request.AddFilterView.Filter.Title = "Hide rows with errors";
request.AddFilterView.Filter.Range = new GridRange();
request.AddFilterView.Filter.Range.SheetId = 0;
request.AddFilterView.Filter.Range.StartColumnIndex = 8;
request.AddFilterView.Filter.Range.EndColumnIndex = 9;
FilterCriteria criteria = new FilterCriteria();
//criteria.Condition = BooleanCondition;
criteria.HiddenValues = new List<string>();
//criteria.HiddenValues.Add("item");
IDictionary<string, FilterCriteria> criteriaDictionary = new Dictionary<string, FilterCriteria>();
//criteriaDictionary.Add("string", criteria);
request.AddFilterView.Filter.Criteria = criteriaDictionary;
The lines that are commented out at the moment are the ones that I can seeking assistance with. I am also trying to find out what the string
variable should be for the criteriaDictionary
.