1. I created a csv file(named billing.csv
) as below and upload it to blob storage.
InstanceID, MeterID, UsageQuantity, ResourceLocation, Pre tax cost
1,1,2,aa,10
2,2,3,bb,20
3,3,5,cc,30
2. In logic app, use "Get blob content" to get the csv file.
![enter image description here](https://i.stack.imgur.com/eR5eO.png)
3. Search the action "Parse CSV" in you logic app.
![enter image description here](https://i.stack.imgur.com/Dxjb0.png)
4. The "Parse CSV" action will ask you to input "API Key", you need to go to this page first --> click "Start free trial", register an account and create a new API Key.
Copy the secret and paste it to your logic app as "API key", it will allow you to connect Plumsail.
![enter image description here](https://i.stack.imgur.com/frYP6.png)
5. Then choose the blob content into the "Parse CSV" and input the headers InstanceID, MeterID, UsageQuantity, ResourceLocation, Pre tax cost
. Add a new parameter "Skip first line" and set its value as Yes
.
![enter image description here](https://i.stack.imgur.com/DXBFr.png)
6. Initialize a variable sum
and set its value as 0
in integer type. Initialize another variable tempItem
and also set its value as 0
.
![enter image description here](https://i.stack.imgur.com/Eeb06.png)
7. Use a "For each" loop.
![enter image description here](https://i.stack.imgur.com/8yqyc.png)
The Body
comes from "Parse CSV" action and the expression of "value" is: add(variables('tempItem'), int(items('For_each')?['Pre tax cost']))
8. After running the logic app, we can see the sum
in last loop is:
![enter image description here](https://i.stack.imgur.com/eYYcy.png)
9. Here is the whole logic app for your reference:
![enter image description here](https://i.stack.imgur.com/aOZ4c.png)
Import:
This solution uses the third party connector "Plumsail Documents", I'm not sure if it is free. I registered account in the past, it worked without any cost. But today the api key can't continue use, I need to register another account and create another api key. So I think this third party connector need extra cost if you want to use it for a long time.