While CSV files may not be the most elegant solution, they are often necessary for integrations and data exchanges. Make offers a straightforward way to automate the creation of CSV files. In this guide, we'll walk you through the steps to create a CSV file from an array using Make.
Prerequisites:
Make account.
Step-by-Step Guide
Sign In: Log into your Make account.
Create a New Scenario: Click on the "Create a new scenario" button.
Collecting Data
We will use a free test API to get some data: https://reqres.in/api/users
Add HTTP Module (Initial Data Request)
Add an HTTP module to make a request to the API.
Configure the HTTP module with the following settings:
Method: GET
Run the module and inspect the data bundles by clicking on the magnifying glass icon.
Add Iterator Module
Add an Iterator module to iterate through each user in the API response.
Configure the Iterator to process the items in the data array returned by the HTTP module.
Add HTTP Module (Detailed Data Request)
Add another HTTP module to make additional requests for more detailed data.
Configure the HTTP module to use the id from the Iterator and fetch additional details.
Method: GET
Add Tools Module (Set Multiple Variables)
Add a Tools module to set multiple variables.
Extract the required fields (id, email, first_name, last_name, avatar) from each item processed by the Iterator.
Creating the CSV File
Add CSV Module:
Search for and select the "Create CSV" module.
Ensure the source module for the CSV is set to the Array Aggregator.
Map each field (email, first_name, last_name, avatar) from the Array Aggregator to the CSV columns.
Storing the CSV File (for this test we will email a copy of the CSV file)
Add Microsoft 365 Email Module:
Add and configure the Microsoft 365 Email module.
Set the action to "Create a Draft Message" and attach the CSV file generated from the previous step.
Configure the email settings such as the subject, content, and recipient email addresses.
By following these steps, you can automate the creation of CSV files from an array using Make with data retrieved from an API. This approach ensures that data is structured and accessible for integrations and data exchanges. While CSV files may not be the most elegant solution, they are often a necessary component in data workflows.
Comments