3 Ways to Export from Excel to SQL Server

3 Ways to Export from Excel to SQL Server
Metric-X Publication
Volume 1, Issue 4
www.metricx.com
Three Ways to Import from Excel to
SQL Server
Outline
Some Options for One-Way Import (from Excel to SQL Server):
 SQL Server Management Studio Import and Export Wizard
 SQL Server Integration Services
 XLhub
Factors to Consider:
 Structure of the data in Excel (tabular vs non-tabular)
 Recurrence of import
 Programming skills of user
Two-Way Connections (Import + Export):
 XLhub enables two-way exchange of data between Excel and SQL Server
Three Options
In this report, we discuss these three options for importing data from Microsoft Excel
to a SQL Server database:
1. SQL Server Management Studio
2. SQL Server Integration Services (SSIS)
3. XLhub Excel Add-In
The right option depends upon one’s situation. The factors to consider are:
1. Is the data in the spreadsheet organized as a table?
2. Will the export be performed by a DBA or programmer?
3. Is the export going to be performed on a recurring basis?
An additional consideration may be whether there is a need to import data back from
SQL Server into Excel.
© 2012 Metric-X, LLC
www.metricx.com
Page 1 of 7
Three Ways to Import from Excel to SQL Server
Decision Flowchart
Below is a decision flowchart for identifying the appropriate option for importing data
from Excel to SQL Server.
Is the data in Excel
organized as a
table (rows and
columns)?
“Frequency of
importing and the
technical capabilities
of the users are
important drivers”
No
Yes
Does the import
need to happen on
recurring basis?
No
Yes
Does the user have
SQL or
Programming
Skils?
Does the user have
SQL or
Programming
Skils?
No
Yes
Yes
or
or
© 2012 Metric-X, LLC
www.metricx.com
Page 2 of 7
Three Ways to Import from Excel to SQL Server
Option Descriptions
This section discusses each of the three options in some detail.
SQL Server Import and Export Wizard
SQL Server Management Studio is the console for managing a SQL Server installation.
It is rich with functionality for managing databases and performing actions on the data
contained in the databases. Management Studio contains a utility for importing and
exporting data from various sources.
This utility, called “SQL Server Import and Export Wizard” is meant for the nonprogrammer.
“Data in the SQL
Server is stored in
database tables.
Each tool requires
that a mapping be
performed between
the Excel dataset and
the SQL Server
database tables”
The wizard is initiated as a task for a database within Management Studio.
The wizard walks the user through a series of dialogs, ultimately requiring the mapping
between the Excel file and the target database table.
The data in the Excel file must begin in the top row of the sheet or be in a named
range or table.
© 2012 Metric-X, LLC
www.metricx.com
Page 3 of 7
Three Ways to Import from Excel to SQL Server
The column mapping dialog shows the columns in the Excel file (source) and
corresponding columns that will be created in the SQL Server table (destination).
The wizard essentially enables the formation of a SQL statement that is executed to
create the desired table and columns.
© 2012 Metric-X, LLC
www.metricx.com
Page 4 of 7
Three Ways to Import from Excel to SQL Server
SQL Server Integration Services
SQL Server Integration Services provides the maximum amount of flexibility but also
requires a programmer to set up the export process.
If the data in the Excel file is not organized in a tabular form (simple rows and
columns) then SSIS may be the only choice.
SSIS enables the creation of recurring process for reading an Excel file (or a CSV),
parsing the data, and loading the data into appropriate columns of a table in a SQL
Server database.
Additional logic for data cleansing can also be included in the import process. The
entire flow for reading, parsing, transforming and loading the data can be defined as a
flowchart and then executed.
The programming logic is defined within Microsoft Visual Studio. Once the program
(referred to as a “package”) has been created and tested, it can be deployed for
execution.
© 2012 Metric-X, LLC
www.metricx.com
Page 5 of 7
Three Ways to Import from Excel to SQL Server
Creating data import jobs within SSIS requires a substantial amount of training, and a
good knowledge of SQL is usually mandatory.
Once a SSIS package has been created, it can be scheduled to run automatically.
XLhub
XLhub is a Microsoft Excel add-in that enables a user to import and export data
between Excel and SQL Server. It is designed to be used by non-programmers.
The XLhub functionality is accessible from within Excel via its own ribbon.
Using a wizard-driven process, XLhub performs the following tasks:
a) Analyzes the data in the Excel file to determine the column names and data
types
b) Creates a table within SQL Server that corresponds to the table in Excel
c) Pushes data from the Excel file into the SQL Server table
 Each time data is saved, it is appended to the same table. This way
previous versions of the data are preserved
d) Reads data from the SQL Server into Excel, and provides the user to select
which previously saved version to retrieve into Excel
“Two-way
connections between
Excel and SQL Server
open up a world of
possibilities for
creating
collaborative
departmental
applications”
Two-Way Connections
A two-way connection between Excel and SQL Server enables saving data from Excel
to SQL Server and also retrieving data from SQL Server into Excel. With this capability,
applications can be rapidly developed which utilize an Excel front-end and a SQL
Server back-end.
© 2012 Metric-X, LLC
www.metricx.com
Page 6 of 7
Three Ways to Import from Excel to SQL Server
Multiple users can save data from their Excel spreadsheets to the same database
table. This way, consolidations are simple, and data can be protected using security
policies within SQL Server. XLhub enables two-way connections.
Multi-user applications that lend themselves well to this capability include:




Budgeting
Forecasting
Financial Consolidations
Timesheets
More information on XLhub can be found at www.xlhub.com.
Metric-X, LLC
About Metric-X:
Metric-X is an information technology firm whose mission is “to help companies
manage and analyze their data.” Metric-X specializes in developing Business
Intelligence solutions based on the Microsoft toolset, including SQL Server, Visual
Studio and Microsoft Office. Within BI, Metric-X focuses its capabilities on the “last
mile of BI”, with solutions aimed at the widespread use of Microsoft Excel among BI
users. Metric-X was founded in 2000, and is located in Perrysburg, Ohio.
28304 Cedar Park Boulevard,
Suite D
Perrysburg, Ohio, 43551
U.S.A.
(248)495-4925
www.metricx.com
metric-x
successful projects
© 2012 Metric-X, LLC
www.metricx.com
Page 7 of 7
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement