473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Importing into MySQL

A client has sent me a (Windows) Excel Spreadsheet (.xls) file
containing a block of data he wants included as a table in a MySQL
database in a (Linux-based) PHP/MySQL Web application I'm developing for
him.

I have both Windows and Linux available on my own machine.

What is the recommended route to get this .xls file into MySQL?
Jan 8 '08 #1
2 2527
On Tue, 08 Jan 2008 19:02:57 +0100, Alan M Dunsmuir
<al**@moonrake. demon.co.ukwrot e:
A client has sent me a (Windows) Excel Spreadsheet (.xls) file
containing a block of data he wants included as a table in a MySQL
database in a (Linux-based) PHP/MySQL Web application I'm developing for
him.

I have both Windows and Linux available on my own machine.

What is the recommended route to get this .xls file into MySQL?
xls -csv -LOAD DATA INFILE
--
Rik Wasmus
Jan 8 '08 #2
NC
On Jan 8, 10:02 am, Alan M Dunsmuir <a...@moonrake. demon.co.ukwrot e:
>
A client has sent me a (Windows) Excel Spreadsheet (.xls)
file containing a block of data he wants included as a table
in a MySQL database in a (Linux-based) PHP/MySQL Web application
I'm developing for him.

I have both Windows and Linux available on my own machine.

What is the recommended route to get this .xls file into MySQL?
Option One.

1. Format all dates in the spreadsheet as yyyy-mm-dd.
2. Save the spreadsheet as CSV (comma-separated variables) file
or tab-delimited text file.
3. Import CSV or text into MySQL using LOAD DATA INFILE query
(be sure to specify proper delimiters and enclosures).

Option Two.

1. In your spreadsheet, construct an INSERT query for the first
record, something like this:

= "INSERT INTO myTable SET id =" & A2 & ", description ='" & A3 &
"';"

2. Use Copy and Paste to construct similar queries for all other
records.

3. Copy the column of queries to Windows Clipboard and paste the
queries into your MySQL client program. Alternatively, paste
the queries into Notepad, save the file as, say, mydata.sql and
run the queries from command line:

mysql [your usual options] < mydata.sql

Cheers,
NC
Jan 9 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8706
by: Andreas Emmert | last post by:
Hi there, I'm trying to import a csv file into my MySQL database. Unfortunately the number format for the price column is formatted in German style, i.e. XX,XX (decimals separated by comma not by dot). When importing this file using LOAD DATA LOCAL INFILE the decimals are cut off. I'm using column type FLOAT for the price column in my database. Is there any chance to preserve the decimals when importing the csv file into my database...
0
2453
by: Campbell's List | last post by:
Hi, I'm completely new to MySql and need help importing tables from Access or Dbase. I am using Dreamweaver MX to create a data-driven web site. With the VPS hosting plan we're on, our remote FreeBSD server only supports the PHP application server. PHP requires MySql. Thus, I installed a copy of MySQL Control Center 0.9.2 beta. (I prefer a GUI and not command prompts unless necessary.) The information I plan on using in developing...
2
2741
by: steve | last post by:
Hi, I have researched but have not found a good solution to this problem. I am importing large amounts of data (over 50 Meg) into a new mysql db that I set up. I use >mysql dbname < importfile.txt But I keep getting timeouts and errors due to the data being too large. I know that since if I break the imported data into multiple chuncks (by importing a few tables at a time) then everything works.
1
3072
by: steve | last post by:
Hi, I have a 80 meg dump file created with mysqldump. I need to import it into a mysql db on Windows. On linux, I say "shell>mysql dbname < dumpfilename" But that does not work on Windows. Importing via phpmyadmin is not possible either since we are limited to 2 Meg file size. Any ideas? Please help.
2
2013
by: Joel | last post by:
Hi, I'm importing our DOS data base (Dataflex) to Mysql I have a table with 174,638 records that I convert into a tab delimetered Text file however, Mysql only reads 87,035! I checked the text file & it apperars fine is there any limitation? Joel
0
1544
by: samershqair | last post by:
Hello everybody, can you tell me please if there is an equivalent MySQL built-in procedure to: SQL built-in : sp_xml_preparedocument and SQL built-in : sp_xml_removedocument and SQL built-in : OpenXML for importing xml into mysql or if there is anyway without the use of navicat or anything else.
1
2490
by: penny111 | last post by:
Hi there, I've migrated a database named "crime" from an MS Access database to MySQL 5.0.37 using the MySQL Migration Toolkit 1.1.11. What i want to do is to copy the database folder from C:\Program Files\MySQL\MySQL Server 5.0\data to the same folder on another machine. So i copied the files directly over, ran MySQL and it recognizes the database (i can see the database included in the list) when i type the command mysql> show...
5
5269
by: Vik Rubenfeld | last post by:
Is there a way to import an MS Access database .mdb file into MySQL running locally on a Mac? Thanks in advance to all for any info.
3
4339
kickingthehabbit
by: kickingthehabbit | last post by:
Hi All new to all of this I just downloaded reactor server. everything works fine except Mysql - SQL import files. I am trying to import file createdb.sql I open DB and try and import with SQL when I try and import it comes back with
0
1268
by: twostepted | last post by:
I'm writing because I saw an earlier post with a similar title dealing with importing xml content into mysql and I couldn't respond to it. I've created a really nice tool for automating this process called SportsFeed. It can be configured to fetch xml data regularly and has scheduling and monitoring support. The content can be saved to disk or database, allowing individual xml element / attribute content to be mapped to database command...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.