Has anyone had any experience with getting data from a CSV into a Global artifact. There doesnt seem to be any native way to do it, so im wondering if theres a way to parse it from a trigger and then add the data that way?
The only way that I found was having an API triggered workflow that adds them to the GA.
Then I have a PowerShell script that parses the CSV and makes an API call for each line.
Not very efficient and a lot of API calls, so any suggestions to improve would be appreciated.
This is a multiple step process.
- Create a global artifact with required schema.
- In your workflow, add a step to convert the csv to base64 with Base64 plugin (action: encoder)
- Add a step convert the base64 output to JSON with csv plugin (action: to JSON). Each line in the csv will be converted to json with the first line as the key and the row entries as the values. This will be output in the “JSON” variable.
- Loop over the JSON variable from previous step and add each item to global artifact.
I tested it with the following csv:
ip,count
1.1.1.1,10
1.1.1.2,20
1.1.1.3,30
1.1.1.4,40
1.1.1.5,50
I was able to add entries to global artifact.