Forum Discussion

AnshumanPatnaik's avatar
AnshumanPatnaik
New Member
1 year ago

Unable to extract Data where sharepoint has multiline statement

I wrote a function and used invoke function to pull multiline data from sharepoint. But the problem is that when the data is entered in a single line with hitting the "Enter Button" it appears properly but if the data is stored using multiline created by hitting wnter button it is not coming up at all.

 

For example if I have updated the data like -
The development is complete. Project is now in SIT phase.

This I am able to pull with invoking the function.

 

But when the update is done like -
Development is complete
Project is now in SIT phase.

 

This one I am not able to pull and show as I have hit "enter" to bring the data to the second line.

 

Can anyone please help with this.

11 Replies

    • AnshumanPatnaik's avatar
      AnshumanPatnaik
      New Member

      After invoking the function I am seeing the column with the data that needs to be pulled.

       

       but here the values are coming as table and some are coming as data.

      But if you click on one of the tables like i did below you will see the actual data.

       

       

       I need this data as well to be displayed along with other updates

      • MFelix's avatar
        MFelix
        Super User

        Hi AnshumanPatnaik ,

         

        Can you please share the M Code for the custom function please. The screenshots do not allow me to see what you are using to get this values.

  • Hi AnshumanPatnaik ,

     

    It appears you're facing a common issue when extracting multi-line text from SharePoint. The problem is that SharePoint wraps each line of a "Multiple lines of text" field in hidden HTML <div> tags when you press "Enter." Your function is likely pulling this raw HTML and only reading the content of the first tag, which is why single-line entries work correctly while multi-line entries do not. To fix this, you need to handle the HTML formatting.

     

    If you are working within Power Automate, the solution is to convert the HTML to plain text. After your "Get item" or "Get items" action, you should add the Html to Text action. The dynamic content from your SharePoint multi-line column should be placed into the Content field of this action. Then, in any following steps, you can use the plain text output from the "Html to Text" action, which will have proper line breaks.

     

    1. Trigger: When an item is created or modified
    2. Action: Get item from SharePoint
    3. Action: Html to Text (Input: YourMultiLineColumn)
    4. Action: Post a message (Input: Plain text output from step 3)


    For those using Power Apps, you have a couple of options. The most direct method is to use an HTML Text control instead of a standard Text Label. You would set the HtmlText property of this control to your SharePoint data, like ThisItem.'YourMultiLineColumnName', and it will render the text with the line breaks intact. Alternatively, if you must use a standard Label, you can convert the HTML to plain text by setting the label's Text property to use the PlainText() function.

    PlainText(ThisItem.'YourMultiLineColumnName')

    When using this function, it is important to also set the label's AutoHeight property to true so it can expand to display all the lines of text.

     

    The underlying reason for this behavior is how SharePoint stores the data. When you input text with a line break, such as "Development is complete" on one line and "Project is now in SIT phase." on the next, SharePoint saves it as HTML code.

    <div>Development is complete</div><div>Project is now in SIT phase.</div>

    The methods described above correctly parse this HTML, ensuring all your text is extracted and displayed as intended.

     

    Best regards,

    • AnshumanPatnaik's avatar
      AnshumanPatnaik
      New Member

      After invoking the function I am seeing the column with the data that needs to be pulled.

       

       but here the values are coming as table and some are coming as data.

      But if you click on one of the tables like i did below you will see the actual data.

       

       

       I need this data as well to be displayed along with other updates

    • AnshumanPatnaik's avatar
      AnshumanPatnaik
      New Member

      After invoking the function I am seeing the column with the data that needs to be pulled.

       but here the values are coming as table and some are coming as data.

      But if you click on one of the tables like i did below you will see the actual data.

       I need this data as well to be displayed along with other updates

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi AnshumanPatnaik ,

    Can you please help us with your M Code or the Custom column code you are using here so that we can assist you properly. The screenshots doesnt give much clarity as to what is happening at the backend which is causing the issue.

    If possible, can you provide a sample data (exclude sensitive information)

    How to provide sample data


    Thank you SamWiseOwl  and DataNinja777  for your inputs to the problem.

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi AnshumanPatnaik ,

    Just wanted to check if you were able to resolve the issue?
    If you need any help, kindly share more details about your data or the error you are getting so that we can assist you better.

    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi @AnshumanPatnaik ,

    Just wanted to check if you were able to resolve the issue?
    If you need any help, kindly share more details about your data or the error you are getting so that we can assist you better.

    Thank You

  • v-sdhruv's avatar
    v-sdhruv
    Community Support

    Hi AnshumanPatnaik ,
    Since we didnt hear back, we would be closing this thread.
    If you need any assistance, feel free to reach out by creating a new post.

    Thank you