web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / CSV to SharePoint list...
Power Automate
Unanswered

CSV to SharePoint list - UTF-8 conversion

(1) ShareShare
ReportReport
Posted on 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

 

Categories:
I have the same question (0)
  • sandeepstw Profile Picture
    312 Moderator on at

    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

  • maxon Profile Picture
    25 on at

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

  • sandeepstw Profile Picture
    312 Moderator on at

    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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard