Holysheets!Logo Holysheets!

Filter conditions

Holysheets! provides a variety of filter conditions to help you query data from your Google Sheets. These filters allow you to specify criteria for selecting rows based on the values in their columns.

equals

Checks if the value in the column equals the specified value.

const user = await userSheet.findFirst({
  where: {
    email: {
      equals: "john.doe@example.com",
    },
  },
});

not

Checks if the value in the column does not equal the specified value.

const users = await userSheet.findMany({
  where: {
    email: {
      not: "john.doe@example.com",
    },
  },
});

in

Checks if the value in the column is included in the specified array.

const users = await userSheet.findMany({
  where: {
    role: {
      in: ["admin", "editor"],
    },
  },
});

notIn

Checks if the value in the column is not included in the specified array.

const users = await userSheet.findMany({
  where: {
    role: {
      notIn: ["guest", "banned"],
    },
  },
});

lt

Checks if the numeric value in the column is less than the specified value.

const users = await userSheet.findMany({
  where: {
    age: {
      lt: 30,
    },
  },
});

lte

Checks if the numeric value in the column is less than or equal to the specified value.

const users = await userSheet.findMany({
  where: {
    age: {
      lte: 30,
    },
  },
});

gt

Checks if the numeric value in the column is greater than the specified value.

const users = await userSheet.findMany({
  where: {
    points: {
      gt: 1000,
    },
  },
});

gte

Checks if the numeric value in the column is greater than or equal to the specified value.

const users = await userSheet.findMany({
  where: {
    points: gte(1000),
  },
});

contains

Checks if the string value in the column contains the specified substring.

const users = await userSheet.findMany({
  where: {
    name: {
      contains: "Doe",
    },
  },
});

Performs a case-insensitive search to check if the string value in the column contains the specified substring.

const users = await userSheet.findMany({
  where: {
    name: {
      search: "doe",
    },
  },
});

startsWith

Checks if the string value in the column starts with the specified substring.

const users = await userSheet.findMany({
  where: {
    name: {
      startsWith: "John",
    },
  },
});

endsWith

Checks if the string value in the column ends with the specified substring.

const users = await userSheet.findMany({
  where: {
    email: {
      endsWith: "@example.com",
    },
  },
});