Skip to main content
All CollectionsData sources
How to Bulk Delete GBT Using Glide API
How to Bulk Delete GBT Using Glide API
Updated over a month ago

In this article, we will show you how to bulk delete data from a Glide Big Table (GBT) by utilizing the Glide API. This approach is especially useful when you need to transfer or clean up data across different apps while maintaining control over your dataset.


Step 1: Prepare Your Glide Big Table

  1. Create Your GBT Table:

    • Begin by creating a Glide Big Table and import all necessary data.

  2. Add a Boolean Column:

    • Name this column Delete?. This will be used as a flag to mark rows for deletion.

  3. Add a RowID Column:

    • This column will store the unique identifier for each row.

  4. Show the Glide API Settings:

    • Right-click on your GBT and select Show API.

    • Choose the cURL option and select Delete rows. This will provide guidance on how to structure the API call for deleting rows. Copy the structure to your note.


Step 2: Build the Mutation for Deletion

  1. Create a JSON Object Column (Mutation Column):

    • Name this column Mutation.

    • Enter the following values into the JSON object:

      { "kind": "delete-row", "tableName": "name of your table in the Glide API", "rowID": "point it to your rowID column" }
  2. Add an If-Then-Else Column:

    • Configure this column to check the Delete? column.

    • If Delete? is checked, return the value from the Mutation column; otherwise, leave it empty.

  3. Add a Lookup Column:

    • Set this lookup to reference the If-Then-Else column.

  4. Create a Joined List Column:

    • Source this from the Lookup column and set a separator (e.g., , ) to combine multiple mutations if needed.

  5. Add a Template Column (Final Body):

    • Name this column Final Body and configure it with the following JSON structure:

      { "appID": "your appID, can be found in the Glide API settings", "mutations": [MUTATION] }
    • Set the MUTATION to be sourced from your Joined List column.


Step 3: Configure the Workflow

  1. Create a Workflow:

    • Point the workflow to your Glide Big Table.

  2. Add a Call API Action:

    • Set the endpoint to:
      https://api.glideapp.io/api/function/mutateTables

    • Choose the POST method.

    • Add the following Headers:

      • Content-Type: application/json

      • Authorization: Bearer YOUR_TOKEN (Replace YOUR_TOKEN with your actual token from the Glide API settings.)

    • For the Request Body, select the Final Body template column.

  3. Add a Wait Action:

    • Insert a wait action of 3 to 5 seconds to allow time for the API call to process.

  4. Add a Reload Query Action:

    • Point this to your GBT to refresh the data.

  5. Final Action:

    • Add a success notification to inform the user that the deletion has been completed.


Step 4: Integrate with the Layout

  1. Add a Button in the Layout Editor:

    • Configure the button to trigger the workflow created above.

  2. Display the Data:

    • Add a data grid or table collection that includes the Delete? column, allowing users to mark rows for deletion.

  3. Test Your Setup:

    • Once the button is clicked and the workflow runs, the specified rows in your GBT should be bulk deleted as per the API mutation.


Conclusion

By following these steps, you can efficiently bulk delete rows in your Glide Big Table using the Glide API. This solution provides flexibility when managing large datasets across different apps. If you’re interested in reviewing a complete working setup, you can check out this template.

Happy Gliding!

Did this answer your question?