• Post Reply Bookmark Topic Watch Topic
  • New Topic

load data from xls and xlsx files in tables mysql  RSS feed

 
shikha nirankari
Ranch Hand
Posts: 47
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to load data from xls and xlsx files into tables in mysql using load data as we can do for csv files.

can anybody help me with the code since its not working for me for xls and xlsx files.

for csv I am using:
LOAD DATA LOCAL INFILE 'C:\\temp\\yourfile.csv' INTO TABLE database.table FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (field1, field2);

but same not working for xls and xlsx files.

Thanks in advance.
 
Tim Moores
Saloon Keeper
Posts: 4024
94
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm fairly certain that only works for CSV files, not XLS or XLSX. You'll need to convert your files to CSV first.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37465
539
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim is correct. You can use Apache POI to read the Excel files and convert them into plain CSV.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!