Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Can AppSheet API handle batch delete operations? What is the payload format?

What is the best way to perform a batch delete operation on an AppSheet database via the API? I’m looking for an efficient way to remove multiple rows at once and would like to know the correct request format and any limitations.

I am consuming the API using Python:

 

chunk_size = 500

for chunk in split_dataframe(json_data, chunk_size):
    data = {
        "Action": "Delete",
        "Properties": {
            "Locale": "pt-BR",
            "Timezone": "America/Sao_Paulo"
        },
        "Rows": [{"key_column": json_data[0]["key_column"]}]
    }

    response = requests.post(url, headers=headers, data=json.dumps(data))

    if response.status_code == 200:
        print(f"Chunk OK! {chunk.index[0]} - {chunk.index[-1]}")
    else:
        print(f"Chunk Error: {response.status_code}, {response.text}")

 

(In this project, I am using an AppSheet database.)

The scope of the deletion I need to perform quickly involves approximately 30,000 rows from a table with around 40 to 50 columns.

The project requires frequent updates to the app’s data since it changes dynamically. This involves managing approximately 10 databases with similar structures and scales.

Currently, I have an efficient method for batch additions, but I am facing challenges with large-scale deletions, such as potential API rate limits, timeouts, or excessive processing time.

What would be the best approach to handle these mass deletions efficiently? Are there any best practices or alternative strategies (e.g., chunking, optimizing API usage, or combining operations) that you would recommend?

 

Solved Solved
0 5 322
1 ACCEPTED SOLUTION

No, not at all.  You have said that you are using the API to do bulk additions?  In that API request you have given a huge list of records to add and the response from the API would have been a huge list of the row ids (keys) that were added?

So, if I already knew the list of row ids I wanted to bulk delete, I would send a simple API call to an Appsheet App that exists solely for the purpose of accepting the API call and acting on it.  This app would not have any views or actions or bots, it would simply have the table that you wish to perform bulk deletions on with that tables primary key clearly defined...that is all.

You would POST your API request to that specific apps unique id and table in the same way you have done for bulk additions (remember to tick the box in your app so that it accepts API requests), but you would use the DELETE keyword and provide the huge list or row ids you want to delete.

View solution in original post

5 REPLIES 5
Top Labels in this Space