Select to view content in your preferred language

Power Automate to Export data everytime a new submission is made

1435
6
Jump to solution
11-21-2023 05:16 AM
SeanNagy1
Regular Contributor

I have a client that is using a form we created in Survey123 but they need to have the data sent to an FTP site in a csv form to be uploaded in an overall system that keeps track of other sensor and reporting data. I want to use Power Automate to create a new csv file everytime a new report is submitted and then send that out to the FTP site. First issue I am finding is 365 only makes normal .xlsx files and not .csv but there might be a converter I can use. The other i wanted to figure out was how to create a new individual file from possibly a template everytime the report is submitted. Below is what I am thinking so far but when i run the flow without the FTP a new file is created but no data from Survey123 has populated the form. I think another module to add data to excel is needed but it needs to reference an already made excel file which defeats the purpose of what I am looking for.

SeanNagy1_0-1700232801829.png

 

4 Solutions

Accepted Solutions
abureaux
MVP Frequent Contributor

You can make a CSV in Power Automate. While I am unfamiliar with your set-up, you appear to be missing a few steps in Power Automate. Is your data stored in a repeat?

Here is a super quick and dirty way to create a CSV from a repeat in S123:

abureaux_0-1700583543414.png

abureaux_1-1700583551611.png

EDIT: Since it isn't apparently obvious for the Apply to each, what you do is create your "Append to array variable" step. Then, as soon as you reference anything in a S123 repeat, it automatically adds the "Apply to Each" step for you. Also, my column names there (testColum1 and testColumn2) are arbitrary and you can replace with anything you want. And finally, the column contents are simply two fields I chose at random from a repeat.

This is the result:

abureaux_2-1700583794669.png

 

View solution in original post

abureaux
MVP Frequent Contributor

No worries! The above steps are actually quite flexible that way.

Just create the "Append to Array Variable", add your desired references, and Power Automate simply won't add the "Apply to Each" step (if it does, that means you have a repeat/array).

View solution in original post

0 Kudos
abureaux
MVP Frequent Contributor

As you said, you don't have a repeat in your survey so you should not need an Apply to Each.

You flow will look like this:

abureaux_0-1700587464925.png

 

When working with surveys in Power Automate, you typically do not need to add Apply to Each steps. As soon as you select a field that requires an Apply to Each, Power Automate automatically adds the Apply to Each step for you. If you selected a field and Power Automate added the Apply to Each for you automatically, then we have a different scenario on our hands (and I'd recommend you upload your XLSX so I could see what fields you are working with).

View solution in original post

SeanNagy1
Regular Contributor

I figured out i needed to select "submittedRecord" from the list of Survey123 outputs for it to grab the correct data. I have it all set up now and it creates a new CSV file saved into my Onedrive account. If anyone wants to see for future reference below is my automation process.

SeanNagy1_0-1700587958479.png

SeanNagy1_1-1700587972101.png

SeanNagy1_2-1700587984141.png

 

 

View solution in original post

6 Replies
abureaux
MVP Frequent Contributor

You can make a CSV in Power Automate. While I am unfamiliar with your set-up, you appear to be missing a few steps in Power Automate. Is your data stored in a repeat?

Here is a super quick and dirty way to create a CSV from a repeat in S123:

abureaux_0-1700583543414.png

abureaux_1-1700583551611.png

EDIT: Since it isn't apparently obvious for the Apply to each, what you do is create your "Append to array variable" step. Then, as soon as you reference anything in a S123 repeat, it automatically adds the "Apply to Each" step for you. Also, my column names there (testColum1 and testColumn2) are arbitrary and you can replace with anything you want. And finally, the column contents are simply two fields I chose at random from a repeat.

This is the result:

abureaux_2-1700583794669.png

 

SeanNagy1
Regular Contributor

I do not have a repeat in my survey. Each form submission creates an individual record so not sure if that would work for my situation. I want each submitted record to be turned into its own CSV file and then sent to the FTP site.

0 Kudos
abureaux
MVP Frequent Contributor

No worries! The above steps are actually quite flexible that way.

Just create the "Append to Array Variable", add your desired references, and Power Automate simply won't add the "Apply to Each" step (if it does, that means you have a repeat/array).

0 Kudos
SeanNagy1
Regular Contributor

Do you know what field i should select in the Apply to Each portion? I get the following error so far with what i have selected to grab from Survey123

SeanNagy1_0-1700587122769.png

 

0 Kudos
abureaux
MVP Frequent Contributor

As you said, you don't have a repeat in your survey so you should not need an Apply to Each.

You flow will look like this:

abureaux_0-1700587464925.png

 

When working with surveys in Power Automate, you typically do not need to add Apply to Each steps. As soon as you select a field that requires an Apply to Each, Power Automate automatically adds the Apply to Each step for you. If you selected a field and Power Automate added the Apply to Each for you automatically, then we have a different scenario on our hands (and I'd recommend you upload your XLSX so I could see what fields you are working with).

SeanNagy1
Regular Contributor

I figured out i needed to select "submittedRecord" from the list of Survey123 outputs for it to grab the correct data. I have it all set up now and it creates a new CSV file saved into my Onedrive account. If anyone wants to see for future reference below is my automation process.

SeanNagy1_0-1700587958479.png

SeanNagy1_1-1700587972101.png

SeanNagy1_2-1700587984141.png