up one level
---
2015-05-23

MySQL Instead of a Spreadsheet for Viewing a Large CSV File

note: originally published 2012-10-11 at a different domain name and url.

recently i had to view a csv file with 150,890 lines in it.  But my spreadsheet app is only able to view 65,000 rows max.  so how?  i loaded the csv file into mysql!

create database logdb;
use logdb;
Create table logtable(
`Id` varchar(250),
`TimeStamp` varchar(250),
`ErrorText` text
)

LOAD DATA LOCAL INFILE ‘C:\\log.csv’
INTO TABLE logtable
FIELDS
TERMINATED BY ‘    ‘
OPTIONALLY ENCLOSED BY ‘”‘
IGNORE 1 LINES;

Query OK, 150890 rows affected (13.05 sec)
Records: 150890  Deleted: 0  Skipped: 0  Warnings: 0


[2019 edit: Moved to: https://i̶n̶v̶e̶s̶t̶o̶r̶w̶o̶r̶k̶e̶r̶.̶c̶o̶m̶/2015/... .html.]