Title: What is the behaviour of CloudBlockBlob.UploadText?
Tags: azure;azure-blob-storage
Question: What is the behaviour of CloudBlockBlob.UploadText if the blob already exist? does it append to the existing blob? or throws an exception?

Here is the accepted answer: If you call CloudBlockBlob.UploadText on an existing blob, the contents of the blob will be updated with the new text. Old contents will be overwritten.
To append text to an existing blob, you could do two things:
Before calling UploadText, get the contents of the blob by downloading the blob and append the new text and then call UploadText. This would work fine for small sized blobs but not for large sized blobs.
Make sure the original blob is uploaded by uploading in chunks i.e. using PutBlock and PutBlockList. Then you get the block list before uploading, append a new block to your blob and then call PutBlockList to commit the changes. This may be an overkill for small sized blobs but work well for large sized blobs.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:12/06/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<azure><azure-blob-storage>', 'Title': 'What is the behaviour of CloudBlockBlob.UploadText?', 'ViewCount': 663, 'id': 20433764, 'user_AboutMe': "<p>I'm a dad, software engineer, maker &amp; DIYer. </p>\n\n<p>I has been writing code since the 90s. Developing in everything from object oriented to functional, and working on projects from web-scale to embedded devices.</p>\n", 'user_AccountId': 2569906.0, 'user_DisplayName': 'Mahmoud Samy', 'user_Reputation': 2752.0, 'user_Views': 210.0, 'user_id': 2228916.0}}