<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D5KZ00001WYBFi0APOkta Identity EngineWorkflowsAnswered2025-11-05T15:31:32.000Z2025-10-24T18:38:46.000Z2025-11-05T15:31:32.000Z

AveryG.27319 (Customer) asked a question.

How do I convert a CSV string from an API to an Object in Workflows

I am reading from an API that sends a response all in one string. It will be used for user generation. It's a properly formatted CSV string, like this:

 

FirstName,LastName,EmployeeNumber

John,Smith,123

Jane,Doe,456

 

Before Okta, I used PowerShell, and I was able to use ConvertFrom-CSV with no issues, but I can't seem to figure it out here. I would like it to be converted to the Workflow Object type for further processing. I see that people are able to import from CSVs on google docs with no issues, but I don't see a built-in function for this. Any advice?


AveryG.27319 likes this.
  • AveryG.27319 (Customer)

    CSV ParseHere's what I came up with

    1. separate on new line
    2. get first item to extract the headers
    3. for each row, split headers and data field on commas and zip them together

    CSV Helper

    Expand Post
    Selected as Best
  • Paul S. (Okta, Inc.)

    Hello @AveryG.27319 (Customer)​ Thank you for posting on our Community page!

     

    The Okta Community Questions forum isn't really meant for in-depth troubleshooting.

    I would recommend to open a Support ticket , then working with the assigned Technical Support Engineers. They'll be able to access additional tools and resources to help you get to the bottom of it.

     

    Thank you for reaching out to our Community and have a great day!

    --

    Help others in the community by liking or hitting Select as Best if this response helped you.

    Expand Post
  • TimL.58332 (Workflows)

    @AveryG.27319 (Customer)​ What you are describing is just a basic string/text (all CSV's are). I am not really sure what your ask is here.

     

    If you are saying: How do I take a plain text block that is in CSV -> line carriage > csv > line carriage and so on... format and write it out to a table.

     

    You would need to first "Split" it by line carriage to make an array(list) of rows. You would then foreach the list of rows to a Helper then split on , to make a list of columns. You could then map the columns to a "Create Row" APi call to Okta Workflows tables or Google Sheets etc.

     

    Obviously you would want to exclude the "header" row so you would add logic into the Helper flow to do so. For example the csv row of FirstName,LastName,EmployeeNumber you would do something like:

     

    1. Continue If Input (A field) type in FirstName
    2. Set condition of "not in"
    3. Output --> Continue If Input (B field)

     

    This would then look for FirstName NOT IN the string of FirstName,LastName,EmployeeNumber then continue the flow processing.

     

    To summarize. Text - Split, For each, and Helper flows are pretty much the route you are going to go when working with plaintext and processing "rows of data".

     

     Here's an example of splitting your input. As you can see I now have a list/array with 3 items. I could foreach those items to a Helper flow to process each line individually.

     

    image 

    Expand Post
    • AveryG.27319 (Customer)

      What I'm looking for is a JSON Parse or XML Parse card but for CSV strings. I ended up writing a CSV Parse workflow of my own

    • AveryG.27319 (Customer)

      CSV ParseHere's what I came up with

      1. separate on new line
      2. get first item to extract the headers
      3. for each row, split headers and data field on commas and zip them together

      CSV Helper

      Expand Post
      Selected as Best
      • TimL.58332 (Workflows)

        @AveryG.27319 (Customer)​  Glad you were able to work out a method that fits your need.

         

        CSV really isn't going to ever have a parse as it isn't considered "Structured Data" like XML & JSON are. It is essentially just a plain text file and any "character" could potentially be the delimiter. "Table" tools like Excel, Gsheets, smartsheets, etc have you provide "meaning" to the values like: Is the first row headers? Which value is the delimiter? And they often assume newline/return is the row delimiter. This is essentially telling the program how to read the file. And is basically what you built out in Workflows.

         

        With structured languages like JSON and XML you don't need to "define" anything as the programs already know how to read them in because the characters have specific structured meaning already.

        Expand Post
  • BrandonB.06003 (Customer)

    looks like you figured it out but yes list map is the best option for this

This question is closed.
Loading
How do I convert a CSV string from an API to an Object in Workflows