Forum Stats

  • 3,767,981 Users
  • 2,252,736 Discussions
  • 7,874,399 Comments

Discussions

import multiple csv files into single mySQL table

r.t.
r.t. Member Posts: 13 Green Ribbon

This might have been discussed but I haven't been to these discussion for years. I have hundreds of csv files that are named as follows: xxyzz_string.csv where xx is 2 character string, y is 1 character, zz is 2 character string. Each csv file has the same number of columns:

value1, value2, value3 (for the sake of example, it doesn't matter what these are, they are just identical across all csv files)

I want to insert all of those csv files into the existing mySQL table that has the following 6 attributes:

xx, y, zz, value1, value2, value3

So the first 3 attribute values will come from the parsed csv filename. The remaining 3 will come from reading the values from those csv files.


Any hint/help/solution is highly appreciated!

Answers