Delete a table.

## 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)
- [Go hello world](https://docs.cloud.google.com/bigtable/docs/samples-go-hello.md.txt)
- [Java hello world](https://docs.cloud.google.com/bigtable/docs/samples-java-hello-world.md.txt)
- [Node.js hello world](https://docs.cloud.google.com/bigtable/docs/samples-nodejs-hello.md.txt)
- [PHP hello world](https://docs.cloud.google.com/bigtable/docs/samples-php-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++
google::cloud::Status status = table_admin.DeleteTable(table.table_name());
if (!status.ok()) throw std::runtime_error(status.message());
```

### 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#
// Clean up. Delete the table.
Console.WriteLine($"Delete table: {tableId}");

bigtableTableAdminClient.DeleteTable(name: tableName);
if (!TableExist(bigtableTableAdminClient))
{
    Console.WriteLine($"Table: {tableId} deleted successfully");
}
```

### Go


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).

```go
log.Printf("Deleting the table")
if err = adminClient.DeleteTable(ctx, &adminpb.DeleteTableRequest{Name: tableFullName}); err != nil {
	log.Fatalf("Could not delete table %s: %v", tableName, err)
}

if err = adminClient.Close(); err != nil {
	log.Fatalf("Could not close admin client: %v", err)
}
```

### 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
System.out.println("\nDeleting table: " + tableId);
try {
  String tableName =
      "projects/" + projectId + "/instances/" + instanceId + "/tables/" + tableId;
  adminClient.deleteTable(tableName);
  System.out.printf("Table %s deleted successfully%n", tableId);
} catch (NotFoundException e) {
  System.err.println("Failed to delete a non-existent table: " + e.getMessage());
}
```

### PHP


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).

```php
try {
    printf('Attempting to delete table %s.' . PHP_EOL, $tableId);
    $deleteTableRequest = (new DeleteTableRequest())
        ->setName($tableName);
    $tableAdminClient->deleteTable($deleteTableRequest);
    printf('Deleted %s table.' . PHP_EOL, $tableId);
} catch (ApiException $e) {
    if ($e->getStatus() === 'NOT_FOUND') {
        printf('Table %s does not exists' . PHP_EOL, $tableId);
    } else {
        throw $e;
    }
}
```

### 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
from google.cloud import bigtable_admin_v2

# the data client only supports the data API. Table deletion is an admin operation
# use admin client to delete the table
admin_client = bigtable_admin_v2.BigtableTableAdminClient()
table_path = admin_client.table_path(project_id, instance_id, table_id)

print("Deleting the {} table.".format(table_id))
admin_client.delete_table(name=table_path)
table.close()
client.close()
```

### 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
puts "Deleting the table #{table_id}"
# Call the admin API to delete the table given its full resource path.
table_client.delete_table name: table_name
```

## 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).