Create a filter to limit the number of versions of columns to retrieve.

## Explore further


For detailed documentation that includes this code sample, see the following:

- [C# hello world](https://docs.cloud.google.com/bigtable/docs/samples-c-sharp-hello.md.txt)
- [C++ hello world](https://docs.cloud.google.com/bigtable/docs/samples-cpp-hello.md.txt)
- [Node.js hello world](https://docs.cloud.google.com/bigtable/docs/samples-nodejs-hello.md.txt)
- [Python hello world](https://docs.cloud.google.com/bigtable/docs/samples-python-hello.md.txt)
- [Ruby hello world](https://docs.cloud.google.com/bigtable/docs/samples-ruby-hello.md.txt)

## Code sample

### C++


To learn how to install and use the client library for Bigtable, see
[Bigtable client libraries](https://docs.cloud.google.com/bigtable/docs/reference/libraries.md.txt).


To authenticate to Bigtable, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```c++
cbt::Filter filter = cbt::Filter::ColumnRangeClosed("family", "c0", "c0");
```

### C#


To learn how to install and use the client library for Bigtable, see
[Bigtable client libraries](https://docs.cloud.google.com/bigtable/docs/reference/libraries.md.txt).


To authenticate to Bigtable, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```c#
RowFilter filter = RowFilters.CellsPerRowLimit(1);
```

### Java


To learn how to install and use the client library for Bigtable, see
[Bigtable client libraries](https://docs.cloud.google.com/bigtable/docs/reference/libraries.md.txt).


To authenticate to Bigtable, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```java
public void filterLimitCellsPerCol(String tableId) {
  // A filter that matches only the most recent cell within each column
  Filter filter = FILTERS.limit().cellsPerColumn(1);
  readRowFilter(tableId, filter);
  readFilter(tableId, filter);
}
```

### Python


To learn how to install and use the client library for Bigtable, see
[Bigtable client libraries](https://docs.cloud.google.com/bigtable/docs/reference/libraries.md.txt).


To authenticate to Bigtable, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```python
# Create a filter to only retrieve the most recent version of the cell
# for each column across entire row.
row_filter = bigtable.data.row_filters.CellsColumnLimitFilter(1)
```

### Ruby


To learn how to install and use the client library for Bigtable, see
[Bigtable client libraries](https://docs.cloud.google.com/bigtable/docs/reference/libraries.md.txt).


To authenticate to Bigtable, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```ruby
# Only retrieve the most recent version of the cell.
filter = Google::Cloud::Bigtable::RowFilter.cells_per_column 1
```

## What's next


To search and filter code samples for other Google Cloud products, see the
[Google Cloud sample browser](https://docs.cloud.google.com/docs/samples.md.txt?product=bigtable).