Scenario:
- Two clients on different machines read a range of cells from a shared workbook (.../drive/{drive-id}/items/{id}/workbook/worksheets/{id|name}/range(address='...').
- If they both don't find the row that they are looking for, they attempt to add a new row to the end of the table.
- If this happens at the same time, both clients might see that row 37 is the end of the table, and they will both attempt to write to row 38, thus one of the new rows may be lost or corrupted.
I suspect this is a common issue (perhaps with other types of files in Sharepoint/Onedrive too), so I was wondering if there is any standardized mechanism within the /workbook APIs (or elsewhere in MS Graph?) to help with synchronization of multiple clients?
I've not actually tried to prove that the above scenario is possible, but I'm not even using sessions when writing to the workbook, and I'm actually writing to one cell at a time, so it's easy to believe that the new row will contain a mix of data from both clients (ie corruption). I could switch to writing the entire row at once, possibly within a session, but it's still safe to assume that one of the two write operations from the two clients will be overwritten.
I suppose I should use the classic "try to create a .lock file next to the xlsx, and if that fails, wait and try again". Is this what people do? Or maybe I should switch from Excel to SQL .
Thanks