Showing results for 
Search instead for 
Did you mean: 

Text (CSV) file - get rows

An action to get rows from a text file (CSV) would be handy.

Status: New
Level: Powered On

@akharns You can do this by setting up a custom Azure function. (You get a million free runs per month.) You can then either set that as a connector or just send a direct HTTP request.

I installed the npm module "csv2json" to the function and then used this as the index.js (where "csvString" is the CSV file set as a string... I'll attach an image.)

module.exports = async function (context, req) {
    context.log('JavaScript HTTP trigger function processed a request.');

    if (req.body.csvString) {
        const csv2json = require('./csv2json.js');
        const csv = (req.body.csvString);

        const json = csv2json(csv, {parseNumbers: true});
            // status: 200, /* Defaults to 200 */
        context.res = { 
                        body: json
    else {
        context.res = {
            status: 400,
            body: "Please pass data into the body."

image.pnginstalled npm module with cmd tool here

image.pngOverall Flowimage.pngHTTP Request to FunctionAppimage.pngParse Data to JSON Object

You can skip the "Transform Data From Parser" step. In my case one of the fields was in the "City, State" format, so I needed to remove that comma in order for the Azure function to work correctly.


From there you can use the "Filter Array" built-in action to filter your data and "length(outputs(your_filter_action))" to return the number of rows that match that criteria.


But, yeah, this should be just built-in to Flow. SO MANY things output CSV files.

Level 8

@nlowman , thanks for the tip.  I'll look into that.  I'll have to get a programmer involved, I think.  At least I have an option.  🙂

Level: Powered On