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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / CSV attachment not par...
Power Automate
Suggested Answer

CSV attachment not parsing — "contentBytes cannot be selected"

(1) ShareShare
ReportReport
Posted on by 4

Hi everyone,

I've built a flow called CSV Attachment to Excel Sync and I'm stuck on an error I can't figure out. Hoping someone here can point me in the right direction.

What the flow is supposed to do:

  1. Trigger: When a new email arrives (V3)
  2. List rows present in a table (Excel)
  3. For each 1 → Delete existing rows
  4. For each 2 → loop through the email's attachments → Get attachment content
  5. CSV - Parse to JSON (pdf4me connector) → then sync the parsed data into an Excel table

The problem:

The run fails at the CSV - Parse to JSON step with this error:

Flow run failed. Action 'CSV_-Parse_to_JSON' failed: Unable to process template language expressions in action 'CSV-_Parse_to_JSON' inputs at line '0' and column '0': 'The template language expression body('Get_attachment_content')?['contentBytes'] cannot be evaluated because property 'contentBytes' cannot be selected. Array elements can only be selected using an integer index.'

What I've noticed:

I'm also not seeing any of the CSV file content in the output of the "Get attachment content" step — it doesn't seem to contain the actual file bytes, which makes me think the attachment content isn't being retrieved at all.

What I've already tried / suspect:

  • The CSV step uses body('Get_attachment_content')?['contentBytes'], but the error says this resolves to an array, not a single attachment.
  • I'm wondering if the trigger's Include Attachments setting or the choice of attachment action is the root cause.

My questions:

  1. Is Get attachment content the correct action to retrieve the CSV bytes, or should I be using Get Attachment (V2)?
  2. Should I reference the current loop item (e.g. items('For_each_2')?['contentBytes']) instead of the action's body output?
  3. Do I even need a separate attachment action if Include Attachments = Yes on the trigger?

Any guidance would be much appreciated. Thanks in advance!Hi everyone,

 

Categories:
I have the same question (0)
  • Suggested answer
    Valantis Profile Picture
    6,778 on at
     
    The error tells you exactly what's happening: body('Get_attachment_content')?['contentBytes'] is returning an array because you're referencing the whole action output, not the current loop item.

    If Include Attachments = Yes on your trigger, you don't need Get attachment content at all. Inside your For each 2 loop, the attachment content is already on the current item. Use:

    items('For_each_2')?['contentBytes']
    That's it. Pass that directly to the CSV Parse step.

    If you do need Get attachment content (for large attachments or a different trigger setup), make sure the action is inside the Apply to each loop and reference its body output as body('Get_attachment_content') not with ?['contentBytes'] on top of it, since the action itself returns the raw bytes as the body.
     
      Best regards,

    Valantis   ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/ 💼 LinkedIn ▶️ YouTube
  • Suggested answer
    11manish Profile Picture
    3,347 on at
    Start by inspecting the raw output of the Get attachment content action. Once you know the exact structure of its output, update the expression (or preferably use Dynamic Content) so that the CSV parser receives the content of a single CSV attachment. This will resolve the template expression error and allow the parser to process the file correctly.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 284

#2
11manish Profile Picture

11manish 257

#3
David_MA Profile Picture

David_MA 192 Super User 2026 Season 1

Last 30 days Overall leaderboard