diff --git a/README.md b/README.md
index 978fc8e..38c72aa 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Datasette plugin for uploading CSV files and converting them to database tables
## Usage
-The plugin adds an interface at `/-/upload-csvs` for uploading a CSV file and using it to create a new database table.
+The plugin adds an interface at `/-/upload-csvs` for uploading a CSV file and using it to create a new database table. The interface provides an option to append rows to an existent table in the database.
By default only [the root actor](https://datasette.readthedocs.io/en/stable/authentication.html#using-the-root-actor) can access the page - so you'll need to run Datasette with the `--root` option and click on the link shown in the terminal to sign in and access the page.
diff --git a/datasette_upload_csvs/__init__.py b/datasette_upload_csvs/__init__.py
index 5d85ec0..fa60eec 100644
--- a/datasette_upload_csvs/__init__.py
+++ b/datasette_upload_csvs/__init__.py
@@ -120,12 +120,13 @@ async def upload_csvs(scope, receive, datasette, request):
if table_name.endswith(".csv"):
table_name = table_name[:-4]
- # If the table already exists, add a suffix
- suffix = 2
- base_table_name = table_name
- while await db.table_exists(table_name):
- table_name = "{}_{}".format(base_table_name, suffix)
- suffix += 1
+ if not formdata.get('append') == 'true':
+ # If the table already exists, add a suffix
+ suffix = 2
+ base_table_name = table_name
+ while await db.table_exists(table_name):
+ table_name = "{}_{}".format(base_table_name, suffix)
+ suffix += 1
total_size = get_temporary_file_size(csv.file)
task_id = str(uuid.uuid4())
diff --git a/datasette_upload_csvs/templates/upload_csv.html b/datasette_upload_csvs/templates/upload_csv.html
index 661abc0..a9dd0f2 100644
--- a/datasette_upload_csvs/templates/upload_csv.html
+++ b/datasette_upload_csvs/templates/upload_csv.html
@@ -71,6 +71,10 @@
Upload CSV
+
+
+
+
@@ -83,6 +87,7 @@
Upload CSV
var progressLabel = document.getElementById("progress-label");
var label = dropArea.getElementsByTagName("label")[0];
var tableName = document.getElementById("id_table_name");
+var tableAppend = document.getElementById("id_table_append");
var databaseName = document.getElementById("id_database");
// State that holds the most-recent uploaded File, from a FileList
@@ -211,6 +216,9 @@