Page 1 of 1
EXCEL to SQL
Posted: Fri Jun 10, 2005 11:30 pm
by bwv2
I have a very large (3.5 GB) EXCEL spreadsheet that I need to use in my website, but it's too large to open and causes my computer to crash. I want to convert it to SQL so that the file size is lowered and will use less space on the server.
Anyone know how to import .xls into an SQL database without opening the excel file?
Posted: Sat Jun 11, 2005 12:02 am
by thegreatone2176
save the file as tab delimited .txt and make a function to read it in , it will use alot of power and such but you only need to do it once.
easier said than done...
Posted: Mon Jun 13, 2005 3:16 pm
by bwv2
Opening the file and saving it as a .txt file would work, except I encounter some problems in the file size. Excel will only support up to 65,536 rows in a spreadsheet. Mine has many many more rows, so when I open the file, it won't load the file completely.
If it helps, my file is a .csv file already (comma separated values), not a .xls file like normal excel worksheets. I tried opening the file with notepad, but got an error saying the file was too big for it. I tried wordpad, but it also had an error. What I need is some sort of script in some language that will read my comma separated file and write to a tab delimited file. Then I could load it into an SQL sheet.
Anyone know how to write a script that would read my .csv and write it as .txt? I seem to remember something like that from c++, but can't remember it. Any help would be great. Thanks.
Posted: Mon Jun 13, 2005 6:20 pm
by froth
Well csv is plaintext so just get_file_contents, explode, and parse into sql...