0

I am having a problem updating a csv file in my blob. I have an existing file inside my blob which is a CSV file, and when I press the download button it will automatically download the file to my machine.

Now I already created a Logic App that will update the csv file. When I run the trigger of the app, it updates the file but when I press download, it opens up a new tab where the csv file will be displayed.

I want it the way like the original when I press download it download the file to my machine.

Any help will do or verification if this is possible.

I already tried "compose" and "create to csv" but this way it will not store it to a blob.

2
  • Are you using the get blob content action ? If you click on show advanced options you will see a Infer Content Type field. Set it to No and it should work. Commented May 8, 2018 at 9:40
  • Because you content-type is text/plain, you need to set it as application/octet-stream. Commented May 8, 2018 at 10:19

1 Answer 1

2

As I have test, when you want to create a .csv file with "create blob" action in logic app, it will always get the same problem with you. Because the blob content is "text/plan" which will display in another tab to show.

So, I suggest that you could use azure function to create the blob. In azure function you could set:blob.Properties.ContentType = "application/octet-stream";

Here is the create blob method in azure function:

    storageAccount = CloudStorageAccount.Parse(connectionString);

    client = storageAccount.CreateCloudBlobClient();

    container = client.GetContainerReference("data");

    await container.CreateIfNotExistsAsync();

    blob = container.GetBlockBlobReference(name);
    blob.Properties.ContentType = "application/octet-stream";

    using (Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(data)))
    {
        await blob.UploadFromStreamAsync(stream);
    }

For more detailed code, you could refer to this article. After following that, you could download your blob in your local machine.

Note: when you create the azure function action in logic app, it will show error. Just delete Appsetting of "AzureWebJobsSecretStorageType" to "blob".

Sign up to request clarification or add additional context in comments.

1 Comment

thanks. Took me a few days to understand but I got it. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.