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 / Extract Data from Shar...
Power Automate
Unanswered

Extract Data from SharePoint List with JSON based on Filter

(0) ShareShare
ReportReport
Posted on by
Hello all,
 
I'm working on creating a Flow for a PowerApp to export information from a DataTable to a CSV. I was able to get the download portion to work, but it doesn't pull the information I'm looking for. I'm new to JSON, but I believe the answer lies in a script for it. 
 
What I'd like to do is pull the top 50 records out of the SharePoint List connected to the DataTable in PowerApps based on SortOrder.Ascending of 'Inv Adj Retail.' Anything under the top 50 sorted by this column doesn't need to be on the Excel spreadsheet. The SharePoint List can hold over 700,000 items, which is information the folks using the app don't need. I have the scripting information below. Please let me know if you need anything more.
 
"Download" button script in PowerApps (I know FirstN brings down the first # of data without sorting):
 
Set(varWhichDownloadInfo, JSON(ShowColumns(FirstN(MyData,50),Department,'Item Description','Inv Adj Units','Inv Adj Retail',PtS),JSONFormat.IndentFour));
Set(varExportToCSV,PowerAppsToExcelDup.Run(varWhichDownloadInfo).linkoutput);
Download(varExportToCSV);
 
Flow JSON Parse script:
 
{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Department": {
                "type": "string"
            },
            "InvAdjRetail": {
                "type": "number"
            },
            "InvAdjUnits": {
                "type": "integer"
            },
            "ItemDescription": {
                "type": "string"
            },
            "PtS": {
                "type": [
                    "number",
                    "null"
                ]
            }
        },
        "required": [
            "Department",
            "InvAdjRetail",
            "InvAdjUnits",
            "ItemDescription",
            "PtS"
        ]
    }
}
 
DataTable script (there's a lot more to it in the real PowerApp. I'm trying this in a test so I don't break the real thing):
 
Sort(MyData,Value('Inv Adj Retail'),SortOrder.Ascending)
 
I attached a picture of the flow, and I generated the Schema from a sample by putting the varWhichDownloadInfo into a text label.
 
And ultimately, I would like it to only pull what is displayed in the DataTable when being downloaded. I've looked into a few different sources (w3schools, Microsoft Power Platform Community, Stack Overflow) and they don't seem to quite touch on what I need. I'm also wondering if I need to put the data from the DataTable into a variable to get it to parse or if that's even possible? 
 
I appreciate any help you can provide. 
Categories:
I have the same question (0)

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

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard