How to read CSV file from OneDrive and upload in Mendix

0
We have requirement to read CSV file from OneDrive folder and upload in Mendix every 15 minutes.
asked
1 answers
1

Hi Ritesh,

To read a CSV file from a OneDrive folder and upload it to Mendix every 15 minutes, you can follow these steps:

1. Set up a scheduled event in your Mendix application to run every 15 minutes. You can do this by creating a microflow with the desired logic and configuring it as a scheduled event.

2. Use the OneDrive API(Microsoft Graph API: https://marketplace.mendix.com/link/component/117007) to access the CSV file from the specified folder. You will need to authenticate your Mendix application with the OneDrive API using the required credentials and obtain an access token.

3. Once you have the access token, you can make an HTTP request to the OneDrive API to fetch the CSV file.  Typically, you would use the `/drive/items/{item-id}/content` endpoint to retrieve the file content.

4. Parse the CSV file data obtained from the API response. Mendix provides various ways to parse CSV data, such as using the CSV module (https://marketplace.mendix.com/link/component/108605) from the App Store or writing custom logic to split and process the file content.

5. Create or update Mendix entities based on the parsed CSV data. You can use the Mendix OData service or custom logic to create or update entities in your Mendix application based on the data extracted from the CSV file.

6. Once the entities are created or updated, you can commit the changes to the Mendix database.

answered