Preventing Multiple Users from Writing to the Same Row in AppSheet

I’m encountering an issue in AppSheet where multiple users unintentionally overwrite each other’s data because they are assigned the same row.

  • When a user opens the app, AppSheet loads the last used row from the cache, rather than fetching the latest data from Google Sheets.

  • If the user doesn’t immediately save their entry and another user opens the app, AppSheet assigns the same row to both users.

  • Since syncing happens after saving (not before), both users end up writing to the same row, leading to data loss.### Question:

    • Is there a way to force a sync before data entry to ensure that users always get the latest available row?
    • Or is there an alternative approach to prevent users from accidentally writing to the same row?

Unfortunately, there is no way to 100% avoid this issue due to the platform design.

AppSheet operates in a distributed fashion which allows it to support offline processing. This means EACH device gets its very own copy of the app and all allowed data. This also means that there is no way for a particular device to know about edits happening on any other device. All edits from all devices are submitted and the last one in wins.

There are a couple of simple ways to avoid this issue:

  1. Process change - adjust processes that use the app so that only a single user is ever editing a single row.

  2. Divide unrelated data into separate tables - often times a data table is built with too much unrelated information contained within it. If the data was placed into different tables then collisions can be avoided.

For instance, consider Order Placement and Shipping address. If these both are on the Order row and someone is editing order details at the same time another is updating the shipping address, they would collide and one would overwrite the other. Instead, Shipping Address is really a Customer attribute and they may have several addresses. So if Shipping Address was moved to an Addresses table, there no longer would be a collision. Order is updated on the order table and Address is updated in the Address table.

I hope this helps!

1 Like