0

I am trying to load data from excel files into a table in MySql. There are 400 excel files in .xlsx format.

I have successfully ingested one file into the table but the problem is that involves manually converting excel file into a csv file, saving it on a location and then running a query to load using LOAD LOCAL INFILE. How to do it for rest of the files.

How to load all the 400 .xlsx files in a folder without converting them manually to .csv files and then running the ingestion query one by one on them.Is there a way in MySql to do that. For example, any FOR Loop that goes through all the files and ingest them in the table.

1 Answer 1

0

Try bulk converting your XLSXs into CSVs using in2csv as found in csvkit.

## single file
in2csv file.xlsx > file.csv

## multiple files
for file in *.xlsx; do in2csv $file > $file.csv; done

Then import data into MySQL using LOAD LOCAL INFILE...

From loading multiple CSVs, use for file in *.csv; do... or see How to Import Multiple csv files into a MySQL Database.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.