Mysql for excel workbench

Содержание

  1. Русские Блоги
  2. О том, как использовать MySQL Workbench для импорта таблиц Excel
  3. О том, как использовать MySQL Workbench для импорта таблиц Excel
  4. 1. Первый шаг: преобразование данных таблицы Excel в файл формата .csv
  5. 2. Преобразовав формат кодирования в Utf-8
  6. 3. Откройте импорт MySQL Workbench
  7. Import Excel File Into a MySQL Database
  8. Use the LOAD DATA Statement to Import Data
  9. Method 2: Use Sqlizer.io to Import Data
  10. Method 3: Import Data Using phpMyAdmin
  11. Conclusions
  12. How to import excel file into MySQL Workbench?
  13. 3 Answers 3
  14. Query Excel Data in MySQL Workbench
  15. Ready to get started?
  16. Create a Virtual MySQL Database for Excel Data
  17. Query Excel from MySQL Workbench
  18. Connect to Excel through Connect
  19. Query Excel Data
  20. Query Excel Data in MySQL Workbench
  21. Ready to get started?
  22. Connect to Excel Data
  23. Configure the SQL Gateway
  24. Query Excel from MySQL Workbench
  25. Connect to Excel through the SQL Gateway
  26. Query Excel Data

Русские Блоги

О том, как использовать MySQL Workbench для импорта таблиц Excel

О том, как использовать MySQL Workbench для импорта таблиц Excel

Концепция двух программных продуктов исходит от Du Niang, чтобы понять:

MySQL WorkbenchПредназначен дляMySQLРазработанный ER /база данныхИнструменты моделирования. Он является преемником известного инструмента проектирования баз данных DBDesigner4. Вы можете использовать MySQL Workbench для проектирования и создания новых диаграмм базы данных, создания документации базы данных и выполнения сложных миграций MySQL.

Microsoft Excel являетсяMicrosoftДля использованияWindowsсApple MacintoshОперационная система, написанная на компьютереЭлектронные таблицыПрограммное обеспечение является одним из самых популярных программ для обработки данных персональных компьютеров.

Есть много способов импортировать данные таблиц Excel из MySQL, вы можете сами Baidu, здесь используется MySQL Workbench, чтобы подробно описать, как импортировать данные таблиц Excel:

1. Первый шаг: преобразование данных таблицы Excel в файл формата .csv

Открыть Сохранить как

Сохранить как файл формата .csv

2. Преобразовав формат кодирования в Utf-8

3. Откройте импорт MySQL Workbench

Импорт выбранного CSV-файла

Установить тип данных и формат кодировки UTF-8

Источник

Import Excel File Into a MySQL Database

This article will teach how to import an excel file into a MySQL database using Workbench, Command-Line Prompt, and phpMyAdmin. This tutorial will take you through a step-by-step guide of the top 3 easiest ways to import excel files into the MySQL databases.

Please enable JavaScript

Use the LOAD DATA Statement to Import Data

Using the LOAD DATA statement in MySQL Workbench, you must have an empty table in your MySQL database.

We have already created a table named tb_students . This table has id , firstname , lastname , gender , and city as column names.

We will convert our file type from .xlsx to .csv to import data into the MySQL database. To do this, open your excel file that has the data.

Click on File->Save As . Make sure that you have selected CSV (Comma delimited)(*.csv) and then press the SAVE .

See the following screenshot.

You now have your data in the *.csv file. We will use the command below to import data from the .csv file into the MySQL database (using Workbench).

In the above LOAD DATA statement, the data from the given file will be collected and inserted into the mentioned table. The first row will be ignored (the column names) because we already have them while creating a table in MySQL Workbench.

In this example, the .csv file’s fields are terminated by a comma. Yours may be terminated by a tab or single space.

If so, replace the line FIELDS TERMINATED BY ‘,’ with FIELDS TERMINATED BY ‘t’ or FIELDS TERMINATED BY ‘ ‘ respectively. Let’s look at the *.csv file’s data and then the MySQL data that are given below.

Data in .CSV File:

Data in MySQL Table:

You can also use the LOAD DATA statement from Command Line (CMD). We have created a new table named tb_students_cmd to practice the command line’s LOAD DATA statement.

Use the LOAD DATA statement to import data via a command-line prompt.

Let’s read the id from tb_students_cmd to confirm that the data is imported. See the following screenshot.

If you see any error about security considerations while using the LOAD DATA statement, then you may visit this website to see the possible solutions.

Method 2: Use Sqlizer.io to Import Data

This method is useful if you don’t want to convert your file type from .xlsx to .csv . Go to sqlizer.io, follow the instructions as follows (or as per your needs).

Select your excel file and MySQL database type. Tell the sqlizer.io by checking or unchecking My File has a Header Row .

Check Use CHECK IF TABLE EXISTS if you want to. If you want to use the active worksheet, check Use the active worksheet .

If not, then tell the worksheet name. We are not using it for this tutorial and prefer to tell the worksheet name, students .

Make sure to tick Convert the whole worksheet to import the whole data. Otherwise, give it the cell range.

You can write your table name (give it a unique name) in which you want the data to be imported. Then, click on the Convert My File button.

You will see the following screen. You can either download the queries or copy them to execute wherever you want.

We can see the following screenshot to confirm that the data is imported, and we can read that.

Method 3: Import Data Using phpMyAdmin

If you are using phpMyAdmin , then you can import data using the following steps (see the given screenshots).

To practice, we have created a new table named tb_students_phpmyadmin . It has five columns named id , firstname , lastname , gender , and city .

Click on the Import tab and select your *.csv file. The Format would be CSV , but you can select according to requirements.

Provide Format-specific Options and click on Go at the bottom-right corner.

You can see that all the records are being imported inserted in the table named tb_students_phpmyadmin as follows.

Let’s see whether the data is imported or not. And here it is! We have imported data.

Conclusions

Finally, we have concluded that you have to use different methods to import data into MySQL.

We saw two methods for importing data from the .csv file to MySQL. It includes the LOAD DATA statement (in workbench and command line) and using phpMyAdmin .

We used sqlizer.io to import data from excel files to MySQL, which is very easy to use also.

Mehvish Ashiq is a former Java Programmer and a Data Science enthusiast who leverages her expertise to help others to learn and grow by creating interesting, useful, and reader-friendly content in Computer Programming, Data Science, and Technology.

Источник

How to import excel file into MySQL Workbench?

I’ve googled this but all the examples are on an old excel. My current excel does not have the option of MySQL on the Data tab. i tried importing through Other Source, SQL Server but it doesn’t connect through Server name. I don’t understand why or if i’m putting in the wrong Server name. Should it be something other than localhost?

3 Answers 3

You cannot import an excel file in MySQL Workbench. That was never possible as it would require to parse the excel file. Instead export your excel file in Excel to CSV and import that in MySQL Workbench.

Importing CSV into MySQL via MySQL Workbench is easy. Open the Table Data Import Wizard from the schema tree:

It allows you to import CSV and JSON data. Select your file on the next page, set import options too (e.g. separator and quote char) and then let it run.

You can copy paste your Excel data in the result grid of Mysql Workbench.

Simply select in your Excel sheet all the rows and columns you want to insert in your database and copy them.

Copying cells containing formulas works, but pay attention to:

  • disable the thousand separator for numbers;
  • change the decimal separator to be a dot for numbers;
  • avoid empty cells as they trigger an error that the column number does not match.

After having copied the cells, right-click in Mysql Workbench on your table and choose «Select Rows» and the results of your query will appear in a result grid.

Right-click in the result grid in the empty row at the bottom and choose «Paste Row» from the menu.

Then click on «Apply» and confirm the insert queries. If everything goes well, your data will be inserted. Otherwise MySQL errors (constraint violations, etc.) are displayed. These errors can help you debugging what went wrong and where you need to correct your Excel data.

For me this works well and I didn’t encounter any encoding issues yet.

However there are performance issues if you want to paste large datasets.

Источник

Query Excel Data in MySQL Workbench

Ready to get started?

Learn more or sign up for a free trial:

Create a virtual MySQL database for Excel data in CData Connect (or Connect Server) and work with live Excel data in MySQL Workbench.

MySQL Workbench allows users to administer MySQL environments and gain better visibility into databases. When paired with CData Connect (on-premise or Connect Server), you get live access to Excel data as if it were a MySQL database. This article shows how to create a virtual database for Excel in Connect and work with live Excel data in MySQL Workbench.

Create a Virtual MySQL Database for Excel Data

CData Connect uses a straightforward, point-and-click interface to connect to data sources and generate APIs.

  1. Login to Connect and click Databases.
  2. Select «Excel» from Available Data Sources.
  3. Enter the necessary authentication properties to connect to Excel.

The ExcelFile, under the Authentication section, must be set to a valid Excel File.

  • Click Test Database.
  • Click Privileges -> Add and add the new user (or an existing user) with the appropriate permissions.
  • With the virtual database created, you are ready to connect to Excel from MySQL Workbench.

    Query Excel from MySQL Workbench

    The steps below outline connecting to the virtual Excel database in Connect from MySQL Workbench and issuing basic queries to work with live Excel data.

    Connect to Excel through Connect

    1. In MySQL Workbench, click to add a new MySQL connection.
    2. Name the connection (CData Connect).
    3. Set the Hostname, Port, and Username parameters to connect to the SQL Gateway.
    4. Click Store in Vault to set and store the password.
    5. Click Test Connection to ensure the connection is configured properly and click OK.

    Query Excel Data

    1. Open the connection you just created (CData Connect).
    2. Click File -> New Query Tab.
    3. Write a SQL query to retrieve Excel data, like SELECT * FROM exceldb.Sheet;

    With access to live Excel data from MySQL Workbench, you can easily query and update Excel, just like you would a MySQL database. Request a demo of the CData Connect and start working with Excel just like a MySQL database today.

    CData Software is a leading provider of data access and connectivity solutions. Our standards-based connectors streamline data access and insulate customers from the complexities of integrating with on-premise or cloud databases, SaaS, APIs, NoSQL, and Big Data.

    Источник

    Query Excel Data in MySQL Workbench

    Ready to get started?

    Download for a free trial:

    The Excel ODBC Driver is a powerful tool that allows you to connect with live Excel file data, directly from any applications that support ODBC connectivity.

    Access Excel Spreadsheet data like you would a database — read, write, and update data through a standard ODBC Driver interface.

    Execute MySQL queries against live Excel data from MySQL Workbench.

    You can use the SQL Gateway from the ODBC Driver for Excel to query Excel data through a MySQL interface. Follow the procedure below to start the MySQL remoting service of the SQL Gateway and work with live Excel data in MySQL Workbench.

    Connect to Excel Data

    If you have not already done so, provide values for the required connection properties in the data source name (DSN). You can use the built-in Microsoft ODBC Data Source Administrator to configure the DSN. This is also the last step of the driver installation. See the «Getting Started» chapter in the help documentation for a guide to using the Microsoft ODBC Data Source Administrator to create and configure a DSN.

    The ExcelFile, under the Authentication section, must be set to a valid Excel File.

    Configure the SQL Gateway

    See the SQL Gateway Overview to set up connectivity to Excel data as a virtual MySQL database. You will configure a MySQL remoting service that listens for MySQL requests from clients. The service can be configured in the SQL Gateway UI.

    Query Excel from MySQL Workbench

    The steps below outline connecting to the virtual Excel database created in the SQL Gateway from MySQL Workbench and issuing basic queries to work with live Excel data.

    Connect to Excel through the SQL Gateway

    1. In MySQL Workbench, click to add a new MySQL connection.
    2. Name the connection (CData SQL Gateway for Excel).
    3. Set the Hostname, Port, and Username parameters to connect to the SQL Gateway.
    4. Click Store in Vault to set and store the password.
    5. Click Test Connection to ensure the connection is configured properly and click OK.

    Query Excel Data

    1. Open the connection you just created (CData SQL Gateway for Excel).
    2. Click File -> New Query Tab.
    3. Write a SQL query to retrieve Excel data, like SELECT * FROM `CData Excel Sys`.Sheet;

    With access to live Excel data from MySQL Workbench, you can easily query and update Excel, just like you would a MySQL database. Get started now with a free, 30-day trial of the CData ODBC Driver for Excel and the CData SQL Gateway.

    CData Software is a leading provider of data access and connectivity solutions. Our standards-based connectors streamline data access and insulate customers from the complexities of integrating with on-premise or cloud databases, SaaS, APIs, NoSQL, and Big Data.

    Источник

    MySQL for Excel 1.3

    MySQL for Excel is an Excel Add-In that is installed and accessed from within the MS Excel’s Data tab offering a wizard-like interface arranged in an elegant yet simple way to help users browse MySQL Schemas, Tables, Views and Procedures and perform data operations against them using MS Excel as the vehicle to drive the data in and out MySQL Databases.
    Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.

    License information can be found in the Installer/LICENSE file.

    Installation

    • Prerequisites:
      • Visual Studio 2015 or greater.
      • .NET Framework 4.5.2 (Client or Full Profile).
      • Microsoft Office Excel 2007 or greater, for Microsoft Windows.
      • Visual Studio 2010 Tools for Office SDK (later called Office Developer Tools).
      • WiX Toolset, for building the installer MSI.
      • MSBuild Community Tasks, for building the installer MSI.
    • Open MySQLForExcel.sln or Package.sln in Visual Studio.

    Features

    MySQL for Excel has been designed to be a simple and friendly tool for data analysts who want to harness the power of MS Excel to play with MySQL data without worrying about the technical details involved to reach the data they want, boosting productivity so they can focus on the data analysis and manipulation.

    • Import Data
      • MySQL for Excel makes the task of getting MySQL data into Excel a very easy one; there are no intermediate CSV files required, only a couple of clicks and data will be imported to Excel. MySQL for Excel supports importing data from tables, views and stored procedures.
    • Export Data
      • MySQL for Excel allows users to create a new MySQL table from selected Excel data; data types are automatically recognized and defaulted for the new table and column names can be created from the first row of data, speeding up the process and making it simple for non-technical users.
    • Append Data
      • MySQL for Excel lets users save selected Excel data in existing tables; it will automatically attempt to map the columns of the selection with the ones in the MySQL table by column name or by data type, users can then review the mapping, manually change it and store it for later use. Like the Export Data feature, appending data into an existing table is very easy.
    • Edit Data
      • MySQL for Excel now provides a way to edit a MySQL table’s data directly within Excel using a new worksheet as a canvas to update existing data, insert new rows and delete existing ones in a very friendly and intuitive way. Changes are pushed back to the MySQL Server as a transaction batch with the click of a button, or can be pushed as soon as they are done with no further clicks if users prefer it. This is a powerful feature since Excel is a natural user interface to operate with data, and these changes can be reflected in the database immediately.

    Documentation

    For further information about MySQL or additional documentation, see:

    • http://www.mysql.com
    • http://dev.mysql.com/doc/mysql-for-excel/en/

    Концепция двух программных продуктов исходит от Du Niang, чтобы понять:

    MySQL WorkbenchПредназначен дляMySQLРазработанный ER /база данныхИнструменты моделирования. Он является преемником известного инструмента проектирования баз данных DBDesigner4. Вы можете использовать MySQL Workbench для проектирования и создания новых диаграмм базы данных, создания документации базы данных и выполнения сложных миграций MySQL.

    Microsoft Excel являетсяMicrosoftДля использованияWindowsсApple MacintoshОперационная система, написанная на компьютереЭлектронные таблицыПрограммное обеспечение является одним из самых популярных программ для обработки данных персональных компьютеров.

    Есть много способов импортировать данные таблиц Excel из MySQL, вы можете сами Baidu, здесь используется MySQL Workbench, чтобы подробно описать, как импортировать данные таблиц Excel:

    1. Первый шаг: преобразование данных таблицы Excel в файл формата .csv

    Открыть Сохранить как

    Сохранить как файл формата .csv

    2. Преобразовав формат кодирования в Utf-8

    3. Откройте импорт MySQL Workbench

    Импорт выбранного CSV-файла

    Установить тип данных и формат кодировки UTF-8

    Импорт успешно выполнен

    4. Наконец

    1. Use the LOAD DATA Statement to Import Data
    2. Method 2: Use Sqlizer.io to Import Data
    3. Method 3: Import Data Using phpMyAdmin
    4. Conclusions

    Import Excel File Into a MySQL Database

    This article will teach how to import an excel file into a MySQL database using Workbench, Command-Line Prompt, and phpMyAdmin. This tutorial will take you through a step-by-step guide of the top 3 easiest ways to import excel files into the MySQL databases.

    Use the LOAD DATA Statement to Import Data

    Using the LOAD DATA statement in MySQL Workbench, you must have an empty table in your MySQL database.

    We have already created a table named tb_students. This table has id, firstname, lastname, gender, and city as column names.

    We will convert our file type from .xlsx to .csv to import data into the MySQL database. To do this, open your excel file that has the data.

    Click on File->Save As. Make sure that you have selected CSV (Comma delimited)(*.csv) and then press the SAVE.

    See the following screenshot.

    top 3 easiest ways to import excel file into mysql database - save as dot csv

    You now have your data in the *.csv file. We will use the command below to import data from the .csv file into the MySQL database (using Workbench).

    # MySQL Version 8.0.27
    LOAD DATA INFILE
    'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/top 5 easiest ways to import excel file into mysql database.csv'
    INTO TABLE tb_students
    FIELDS TERMINATED BY ','
    ENCLOSED BY '"'
    LINES TERMINATED BY 'n'
    IGNORE 1 ROWS;
    

    In the above LOAD DATA statement, the data from the given file will be collected and inserted into the mentioned table. The first row will be ignored (the column names) because we already have them while creating a table in MySQL Workbench.

    In this example, the .csv file’s fields are terminated by a comma. Yours may be terminated by a tab or single space.

    If so, replace the line FIELDS TERMINATED BY ',' with FIELDS TERMINATED BY 't' or FIELDS TERMINATED BY ' ' respectively. Let’s look at the *.csv file’s data and then the MySQL data that are given below.

    Data in .CSV File:

    top 3 easiest ways to import excel file into mysql database - csv file data

    Data in MySQL Table:

    top 3 easiest ways to import excel file into mysql database - table data in mysql

    You can also use the LOAD DATA statement from Command Line (CMD). We have created a new table named tb_students_cmd to practice the command line’s LOAD DATA statement.

    top 3 easiest ways to import excel file into mysql database - new table for cmd

    Use the LOAD DATA statement to import data via a command-line prompt.

    top 3 easiest ways to import excel file into mysql database - load data command in cmd

    Let’s read the id from tb_students_cmd to confirm that the data is imported. See the following screenshot.

    top 3 easiest ways to import excel file into mysql database - load data output in cmd

    If you see any error about security considerations while using the LOAD DATA statement, then you may visit this website to see the possible solutions.

    Method 2: Use Sqlizer.io to Import Data

    This method is useful if you don’t want to convert your file type from .xlsx to .csv. Go to sqlizer.io, follow the instructions as follows (or as per your needs).

    Select your excel file and MySQL database type. Tell the sqlizer.io by checking or unchecking My File has a Header Row.

    Check Use CHECK IF TABLE EXISTS if you want to. If you want to use the active worksheet, check Use the active worksheet.

    If not, then tell the worksheet name. We are not using it for this tutorial and prefer to tell the worksheet name, students.

    Make sure to tick Convert the whole worksheet to import the whole data. Otherwise, give it the cell range.

    You can write your table name (give it a unique name) in which you want the data to be imported. Then, click on the Convert My File button.

    top 3 easiest ways to import excel file into mysql database - sqlizerio

    You will see the following screen. You can either download the queries or copy them to execute wherever you want.

    top 3 easiest ways to import excel file into mysql database - sqlizerio queries

    We can see the following screenshot to confirm that the data is imported, and we can read that.

    top 3 easiest ways to import excel file into mysql database - sqlizerio queries data

    Method 3: Import Data Using phpMyAdmin

    If you are using phpMyAdmin, then you can import data using the following steps (see the given screenshots).

    To practice, we have created a new table named tb_students_phpmyadmin. It has five columns named id, firstname, lastname, gender, and city.

    Click on the Import tab and select your *.csv file. The Format would be CSV, but you can select according to requirements.

    Provide Format-specific Options and click on Go at the bottom-right corner.

    top 3 easiest ways to import excel file into mysql database - import data using phpmyadmin part 1

    top 3 easiest ways to import excel file into mysql database - import data using phpmyadmin part 2

    You can see that all the records are being imported inserted in the table named tb_students_phpmyadmin as follows.

    top 3 easiest ways to import excel file into mysql database - import data using phpmyadmin part 3

    Let’s see whether the data is imported or not. And here it is! We have imported data.

    top 3 easiest ways to import excel file into mysql database - import data using phpmyadmin part 4

    Conclusions

    Finally, we have concluded that you have to use different methods to import data into MySQL.

    We saw two methods for importing data from the .csv file to MySQL. It includes the LOAD DATA statement (in workbench and command line) and using phpMyAdmin.

    We used sqlizer.io to import data from excel files to MySQL, which is very easy to use also.

    I recently had a need to import a bunch of data into MySQL, and for reasons I won’t get into here, LOAD DATA INFILE wasn’t working for me.  I was in a hurry to get the data into MySQL so that I could filter it, and didn’t have time to work through my LOAD DATA INFILE issues.  Looking around for another way to quickly get my tab-delimited data into MySQL quickly, I decided to use the MySQL for Excel plugin.  If you haven’t seen this yet, and you have Excel, it might be worth your while.

    In my case, I was able to quickly copy and paste the tab-delimited text file into an Excel spreadsheet, connect MySQL for Excel to the MySQL database and append the data to the existing table.  You’ll need to have Excel, MySQL and the MySQL for Excel plugin.  The latter two can be installed from a single download using the MySQL Installer for Windows.

    Here’s a very quick visual tutorial on how this works:

    First, create the table.  I’m doing this in MySQL Workbench:, but you can do the same via the mysql command-line client if you prefer:

    Create the table in MySQL Workbench

    Create the table in MySQL Workbench

    Next, open Excel and click on the “Data” tab:

    Navigate to Data tab in Excel

    Navigate to Data tab in Excel

    You’ll see the “MySQL for Excel” button if you’ve installed the MySQL for Excel product using the MySQL Windows Installer.  Click on it, and a menu opens up on the right-hand side.  This lists the saved connections you’ve created in Workbench, or allows you to create a new connection:

    Select MySQL connection to use

    Select MySQL connection to use

    I double-clicked the correct instance (“3307” is my stored connection to the instance I have running on port 3307 locally), which brings  up a list of database schemas:

    Select database schema

    Select database schema

    Selecting the “test” database brings up a list of tables, including the excel_test table I created earlier:

    Select table in Excel

    Select table in Excel

    Selecting the excel_test database enables options to import or edit MySQL data.  In the next screenshot, I’ve added some data to the Excel cells and highlighted it.  This enables the “Append Excel Data to Table” option we want:

    Select data to append to table

    Select data to append to table

    That brings up a wizard to help you map the Excel columns to database columns.  In my case, the automatic mapping worked right, but you can make changes to ensure that the mapping is done correctly:

    Map columns to table structure

    Map columns to table structure

    Clicking the “Append” button in the wizard completes the process, and a confirmation message is displayed.  I expanded the optional details for the following screenprint:

    Confirm data appended successfully

    Confirm data appended successfully

    For confirmation, I return to Workbench and query the table:

    Verify table changes using MySQL Workbench

    Verify table changes using MySQL Workbench

    If you are an Excel user and haven’t yet tried this new tool, give it a go – it’s worth the time!

    Like this post? Please share to your friends:
  • Mysql for excel export data
  • Mysql export to excel file
  • Mysql connector для excel
  • Myriad pro шрифт скачать word
  • My worst things in the word