• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How can I get Excel data into MySQL, or vice versa?

by admin

Excel and MySQL can read and write delimited text (CSV) files. To load a text file into MySQL, use the LOAD DATA INFILE statement.

To create a text file from MySQL, use the SELECT INTO OUTFILE syntax, or the ability of the client to write or redirect to a file. For example:

$ mysql -e "SELECT * FROM tblname" > outfile.txt

Graphical clients such as MySQL Workbench can also send the results of a query to a file.

Another way to export query results to a file on the client host is to use the mysql_to_text.pl utility, available in the recipes distribution. That program has options that enable you to specify the output format explicitly. To export a query result as an Excel spreadsheet or XML document, use mysql_to_excel.pl and mysql_to_xml.pl utilities.

Filed Under: MariaDB, mysql

Some more articles you might also be interested in …

  1. Beginners Guide to MySQL User Management
  2. Multi-Versioning in MySQL Database
  3. Configuring mysqld to log slow queries
  4. Understanding the REVOKE statement in MySQL
  5. How to Configure Multiple MySQL Servers On One System Using mysqld_multi
  6. Understanding MySQL Pluggable Authentication
  7. How to find the size of a MySQL database
  8. How To Install MySQL RPM packages in a different location to allow multiple versions (versions < 5.6.10)
  9. How to use foreign keys to attain referential integrity in MySQL
  10. How to install and configure MySQL sys schema

You May Also Like

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright