CSV Import - pre match columns from csv to columns of table

CSV Import - pre match columns from csv to columns of table

schwaluckschwaluck Posts: 103Questions: 27Answers: 1

Hello all,

I use on my site the function to import data from a CSV file with the Papaparse Library.
Now the CSV file has always about 20 columns and imported are always the 8 same columns, which are also always assigned to the same 8 columns in the table.
When importing, the columns from the CSV now always have to be assigned to the columns from the table. I wondered whether it would be possible to predefine this assignment so that, for example, column " Sample 1 " from the CSV is always assigned to " Sample 8 " in the table as soon as you click on the CSV Import button.

Does anyone of you happen to have an idea how this could be realized?

Many greetings

Schwaluck

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    If you know what the mapping is going to be, you can skip the selectEditor part (variable name from the example) entirely.

    The key is line 42 in that example where the data is set into the host Editor instance based on the mapping provided.

    Allan

  • schwaluckschwaluck Posts: 103Questions: 27Answers: 1

    Hi Allan,

    thanks a lot - that works like a charm!

    I just passed in the column headers of the csv file as the mapped array and accessed it within the given function from the example.

    Thanks a lot :)

    Regards,
    schwaluck

Sign In or Register to comment.