Add Data From Excel Using

In this episode I'm going to show you how you can add large number of data to your Directus database using #Excel and Flows.
Ok, let's do one more Directus Flow, well actually two flows that are going to work in conjunction with one another.
So imagine you have a movie database type of website, and you want to add a large number of movies to it. Currently, you have those movies stored in a Google Sheets or an Excel Document. Of course, you don't wanna do that by hand, because it will take a long time to do it.
We can use Flows for this type of scenario, we will first save our Google Sheets or Excel document to a CSV file. We are going to parse that file on the front end and create a JSON object which we will send to a Directus Webhook, that will in turn trigger our first Flow. Since we are receiving an array of objects we can create a kind of for each loop by triggering another Flow for every object in that array. That other Flow is just simply going to add the data from the object it receives to the Movie collection.
Ok, so let's do this.
Code used in this video
bit.ly/3G4hW87
You can support my work on Patreon
/ watchlearn
Follow me on Social Media
Github: github.com/ivandoric
Twitter: / ivan_doric

Пікірлер: 15

  • @IshaqKhan010
    @IshaqKhan01019 күн бұрын

    sir i have payload of millions records how i can add it, which have foreign contains too, in minimum time;

  • @anassfiqhi3517
    @anassfiqhi3517 Жыл бұрын

    Please more flows

  • @ThomasFlorence
    @ThomasFlorence Жыл бұрын

    Thanks

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    Жыл бұрын

    Thanks for the tip man 😄

  • @RobertWildling
    @RobertWildling11 ай бұрын

    Great Example, thank you very much! - Unfortunately I get a CORS error as soon as I upload the csv file. Tried to add CORS to Directus' .env file, but no changes. Do I have to change the headers in the React App? Or what do I have to do? I just tried "mode:'no-cors" on the fetch method, but then I get the weird console error "add-movie.jsx:34 Error: SyntaxError: Unexpected end of input (at add-movie.jsx:29:38)"

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    11 ай бұрын

    Hmmm, what version of Node are you using?

  • @JoeHannouch
    @JoeHannouch7 ай бұрын

    Amazing, i will be doing something very similar. Apart from parsing in the format we want, what is the advantage of this example compared to the built in CSV importer of Directus?

  • @WatchandLearnTutorials

    @WatchandLearnTutorials

    7 ай бұрын

    This is just an example of what Directus can do. Of course if importing CSV makes more sense you should use that.

  • @JoeHannouch

    @JoeHannouch

    5 ай бұрын

    @@WatchandLearnTutorials Indeed, the default CSV is useful but not very flexible, doing it with Flows gives much more control and results in cleaner Excel sheets.

  • @meerzulee
    @meerzulee Жыл бұрын

    How do you iterate over arrays? or the flow does it automatically?

  • @RobertWildling

    @RobertWildling

    11 ай бұрын

    I don't know React, but isn't useEffect triggered with each element that is added to moviesList? And therefore there are 5 calls to the webhook? UPDATE: Actually it is explained at 4:05ff: When data is delivered as an array than the flow triggers the other flow on each item. Seems as if the loop is built-in to the first flow...

  • @danwahn

    @danwahn

    6 ай бұрын

    @@RobertWildling @WatchandLearnTutorials - I am actually doing exactly the same thing - passing an array to the 2nd flow. But it fails with 'undefined'. I tried many different JSON payloads, but it always seems to get the full array, not iterating over the array.

  • @greendsnow
    @greendsnow9 ай бұрын

    do we need to sanitize the data?

  • @harrishpaul7374
    @harrishpaul737410 ай бұрын

    How to update a collection using webhook

  • @harrishpaul7374
    @harrishpaul737410 ай бұрын

    discord