Filter Label columns from Google Sheets

Hi,

I am creating a bar graph from Google Sheets. Is there a way to show specific Labels only? Currently, I specify the Label column and pull everything from that column.

Thanks

Hi @jcmaad,

This is a good idea so we’ve just added the functionality. Here’s an example of using the Google Sheets plugin with a filter object to show specific labels only:

{
  // ...
  plugins: {
    googleSheets: {
      sheetUrl:
        'https://docs.google.com/spreadsheets/d/121DpBzwABbNB7JO3--dXGTI3CE2LL1WwPHXKCYDdsKM/edit#gid=0',
      labelColumn: 'Name',
      dataColumns: ['Usage count', 'Payment'],
      filters: {
        // Exclude Joe's column
        labels: (labelName) => labelName !== 'Joe',
      },
    },
  },
}

Link to example in chart editor

Hope this helps!

1 Like

Hello @ian ,
Thanks for the wonderful add-on!
I would like to ask a question related to this topic. Is it possible to specify a different column for the filters?
I am trying to write a line graph per person, using the “date” as the label column (x axis) and use the filter function to make a graph per person (filtering with a different “name” column).
Thanks in advance,
Ken

Hi @KenMor,

This is a great idea but not something that’s currently possible. I’ve put it in our backlog and we’ll prioritize it soon. I’ll follow up here when it’s ready.

Ian

Hello Ian,

Thank you! I’ll be looking forward to it.

Ken