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.
3. Search the action "Parse CSV" in you logic app.
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.
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
.
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
.
7. Use a "For each" loop.
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:
9. Here is the whole logic app for your reference:
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.