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 / Base64tostring on csv ...
Power Automate
Unanswered

Base64tostring on csv file $content is filled with junk

(0) ShareShare
ReportReport
Posted on by 18

Hello all!

 

I have built a Sharepoint site where Sharepoint events point to Teams webinar registration links for various training courses used by various employees through my organisation.

 

I'm then getting the .csv report from each event to get the attendance list and I have created a flow that triggers when the .csv files are dropped in a specific Sharepoint folder.

 

Before the flow triggers, please note that I can open the .csv file in Excel or Notepad++ and the information is displayed correctly (the data is not corrupted or badly encoded).

 

The flow does 2 specific things:

 

1. Get information from the ActiveDirectory for each attendee and put that information in a dashboard so we can get statistics for attendance in each department.

2. Export the user data on a Sharepoint list used to send e-mail surveys based on attendance for each event (sending the survey is a separate flow to automate it all).

 

I'm using the trigger "When file created (properties only)" following by a condition that makes sure it's a .csv file.

 

I then get the file content (It doesn't matter if I select "yes" or "no" to the infer question; the result is the same):

 

Louis1911_1-1698353158513.png

with the following output:

{
  "$content-type""application/octet-stream",
  "$content""//4xAC4AIABSAOkAYwBhAHAAaQ..."
}
 

I have searched for a while as to what to do past this point. I read that I can use the base64tostring() formula to decode the content. While using this formula:

 

decodebase64(outputs('Obtenir_le_contenu_du_fichier')?['body']['$content'])
 
I can see that I decoded the string, however it's filled with garbage:
 
Louis1911_2-1698353305016.png

 

When I input the $content string on https://www.base64decode.org/, I can see the data formated the way I want it and without the garbage.

 

I'm wondering what to do at this point, I have tried using the OneDrive for Business action to get the file, but I can't seem to use it to fetch a file on Sharepoint. I have found a few posts with users reporting this exact behavior, but none of them get a solution that works for me.

 

I know I could purchase some premium connector to parse the .csv, but that option isn't accessible to me. I'm confident I can manually parse the .csv and do what I want with the data after I get a clean conversion. I'm assuming it must have something to do with the conversion format, but I'm not sure how to tackle it.

 

Oh and I had another flow that did the exact same thing, but with the deprecated trigger "get file when created" and I'm trying to build a flow that is not based on a deprecated action.

 

Thank you!

 

Edited to clarify my goal with the flow as well as additional test information.

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,315 Super User 2025 Season 2 on at

    Hi @Louis1911 

     

    Stupid question... have you tried simply writing the data to a file and opening it to see if its correct?

     

    You would write the body/content value. This is normally what I would do so I am just wondering if there really is a need to do anything else?

     

    Because I dont know why if you are just trying to grab the content of a file and write it somewhere else, you need to do anything to it but read it and write it.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • LS-25041257-0 Profile Picture
    18 on at

    The goal of the flow is to take the attendee report and to do some operations with the names (namely to get some information from the ActiveDirectory and to put it on a dashboard). I also use the users information in another Sharepoint list to do some more operations (namely to send them an e-mail with a survey in it).

     

    The attendee report is a .csv file that I can open and manipulate with no problem at all. I'll give it a try tommorow to create a new file in the flow and see what the result is.

  • Michael E. Gernaey Profile Picture
    53,315 Super User 2025 Season 2 on at

    @Louis1911 

     

    Ahh okay it wasn't clear what you were doing. Sorry.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • LS-25041257-0 Profile Picture
    18 on at

    I have made a few other tests where I take the string from $content in the flow and then use the plugin -->MIME tools --> Base64 decode in Notepad++

     

    Louis1911_0-1698409000478.png

    I'm getting the same result as my flow (each character seems to be separated by a NULL value) :

     

    Louis1911_1-1698409079290.png

     

    However, if I open the .csv file manually and encode it in Base64 using the same tool, it gives me a completely different string.

     

    If I take that string in my compose and use the base64tostring formula, it works!

     

    Louis1911_2-1698409798007.png

     

    I have done the same exercice on base64encode.com and it's giving me the exact same string as notepad++.

     

    I'm thinking now that the action to get the file content is doing an additional operation that I'm not aware of.

     

    If I use the deprecated trigger when a file is created in a folder that immediately returns the content, it detects the proper content type and automatically decodes the information properly:

     

    Louis1911_4-1698410588407.png

     

     

    Louis1911_3-1698410574937.png

    It gives me the application/octet-stream content-type with the get file content action:

     

    Louis1911_5-1698410691181.png

     

     

    edited to add some test results

  • YYCRMGuy Profile Picture
    9 on at
    Were you ever able to get the root of this issue? I am doing basically the same thing and running into the same problem.

    Though I've found it seems to depend on whether the file is downloaded by the Organizer (decodes to junk) or from the Teams Admin Center (works). I've also determined that the file you get as the organizer is a Tab delimited file with .csv extension, whereas the file from the admin center is a comma delimited .csv file. That was a pain.
  • LS-25041257-0 Profile Picture
    18 on at
    The issue still isn't fixed, so I've been running with the deprecated action for over a year and a half now.

    I might give it a try when I have some free time to see if changing the file download source might correct the issue. Thanks for posting the infromation!

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard