Skip to main content
Community site session details

Community site session details

Session Id : Z0aFnCtGK1ptT43B1UN0jk
Power Automate - General Discussion
Unanswered

CSV to SharePoint list - UTF-8 conversion

Like (1) ShareShare
ReportReport
Posted on 7 Jun 2024 12:50:37 by 25

Hi, I am carrying out my first project, one element of which is to transfer data from a csv file to a sharpoint list. The whole process works, however I am stuck with a problem with special characters. I have read that this is a known problem with UTF-8, but I don't really know how to implement it. 

Currently the csv file as I open in notepad I see all values correctly, but at the InputToString 

base64ToString(triggerBody()?[‘file’][‘contentBytes’]

stage I already have error stamps. I have read to apply this

concat(decodeUriComponent('%EF%BB%BF'), your_file_content)

, but have no idea how 🙂

Capture.PNG

I would be grateful for your support!

Thanks

Max

 

  • sandeepstw Profile Picture
    302 Moderator on 11 Jun 2024 at 12:30:44
    Re: CSV to SharePoint list - UTF-8 conversion

    HI @maxon ,

     

    You need to create customer connector or any api to convert your file or you can do manually. Here is c# Azure Function code to convert UTF-8

    using System.IO;
    using Microsoft.AspNetCore.Mvc;
    using Microsoft.Azure.WebJobs;
    using Microsoft.Azure.WebJobs.Extensions.Http;
    using Microsoft.AspNetCore.Http;
    using Microsoft.Extensions.Logging;
    using System.Text;
    
    public static class ConvertAnsiToUtf8
    {
     [FunctionName("ConvertAnsiToUtf8")]
     public static async Task<IActionResult> Run(
     [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
     ILogger log)
     {
     string requestBody = await new StreamReader(req.Body, Encoding.GetEncoding("windows-1252")).ReadToEndAsync();
     byte[] utf8Bytes = Encoding.UTF8.GetBytes(requestBody);
     string utf8String = Encoding.UTF8.GetString(utf8Bytes);
     return new OkObjectResult(utf8String);
     }
    }
    

    Mark as solution if it helps. 

     

    Thanks,

    Sandeep Mishra

  • maxon Profile Picture
    25 on 11 Jun 2024 at 12:11:28
    Re: CSV to SharePoint list - UTF-8 conversion

    the problem is that csv is saved as ANSI not UTF-8

  • sandeepstw Profile Picture
    302 Moderator on 11 Jun 2024 at 10:21:06
    Re: CSV to SharePoint list - UTF-8 conversion

    HI @maxon ,

     

    Make sure your CSV file is saved with UTF-8 encoding.

    then use
    When a file is created or modified in OneDrive. Use "Get file content". Use compose action to add BOM
    concat(decodeUriComponent('%EF%BB%BF'), base64ToString(triggerBody()?['file']['contentBytes']))

    then parse CSV and then iterate through the CSV rows and create SharePoint list items.

     

    Mark as solution if it helps. 

     

    Thanks,

    Sandeep Mishra

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete