Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:46:35+00:00 2026-06-13T20:46:35+00:00

I have a excel worksheet (.xls). I need to convert it into sql script.

  • 0

I have a excel worksheet (.xls). I need to convert it into sql script. The single excel worksheet consists of multiple tables. So the resultant script should have multiple create table and insert statements.
I tried various tools such as http://www.sqlconverter.com/ but I am unable to get a proper solution. Any other way I can do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:46:36+00:00Added an answer on June 13, 2026 at 8:46 pm

    I noticed your comment that using the import wizard was more complicated of a solution than you wanted, so you must be trying to load data.

    You can try BULK INSERT:

    First, do a SAVE AS on each sheet and convert them to CSV files. You should have one CSV file for each sheet you want to import.

    Next, make a table with the similar data types and length that you’ll be bringing in. A typical Excel cell is a VARCHAR(255), (probably more like NVARCHAR(255) if you want to be specific, but we’ll avoid unicode for this solution).

    So, if your excel sheet had 5 columns:

    CREATE TABLE Sheet1
    (Column1 VARCHAR(255)
    , Column2 VARCHAR(255)
    , Column3 VARCHAR(255)
    , Column4 VARCHAR(255)
    , Column5 VARCHAR(255)
    )
    

    Then you can write a simple bulk insert to the table PROVIDED you have the file on network share or local the to server/machine where the SQL instance is. For example, if you had the file on your machine and wanted to try and push to a server out on the network, SQL would think the C:\ in the script below was on the server and not your machine. You would have to share a folder and access it over the network: \\MyMachineName\SharedFolder\Sheet1.csv

    BULK INSERT dbo.Sheet1
    FROM 'C:\LocalFolder\WhereTheFileIs\Sheet1.csv'
    WITH (
    FIELDTERMINATOR = ','
    , ROWTERMINATOR = '\n'
    )
    

    This should get the data into that table provided the same number of columns exist in the file and table.

    It’s not pretty, but it’s simple. The BULK INSERT is a tried and true method of basic and quick loading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a need to copy a worksheet from one workbook into another and
currently I have a web which loads excel spreadsheet data into SQL database. When
I want to import data from Excel worksheet into SQL Server database (2008). I
A stored proc (SQL Server 2008) returns multiple result sets. An Excel (.xls) file
I have a shared Excel worksheet (using .XLS due to compatibility issues), which I
I have the following Excel worksheet: | A B C -+--------------- 1|id date views
I am creating an Excel Worksheet from C# using Microsoft.Office.Interop.Excel, and I have not
I have an Excel 2010 workbook for financial records. On one worksheet, I have
I have an Excel Workbook that has several worksheets in it. The tables in
We have an Excel file with a worksheet containing people records. 1. Phone Number

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.