Home » excel » no results found when loading Excel file mySQL

no results found when loading Excel file mySQL

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am trying to load an excel file .XLSX, when running it shows Success, but no results were found. In the excel file there are results mainly 3 columns:
Region (text column)
2018M01 (decimal values)
2018M02 (decimal values)

My code is:

DROP TABLE IF EXISTS book;

CREATE TABLE book (
    Region LONGTEXT,
    2018M01 decimal(4,2),
    2018M02 decimal(4,2)
);

LOAD DATA LOCAL INFILE 'C:/Users/BPerei23/Downloads/Book1.xlsx' 
REPLACE INTO TABLE book
CHARACTER SET Latin1 FIELDS TERMINATED BY ',' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\r\n' 
IGNORE 1 LINES;

Can someone pls advice why its not loading properly? Thank you

How to&Answers:

LOAD DATA INFILE doesn’t handle Microsoft’s proprietary .xlsx format for spreadsheets. Save the file as a .csv file and try again.