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 6007063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:37:42+00:00 2026-05-23T01:37:42+00:00

I have a relatively complicated excel sheet in which columns start at A and

  • 0

I have a relatively complicated excel sheet in which columns start at A and end at BB and rows start at 5 and end at 203.

What I would like to do is tell MySQL that each column of data (with a header that I do not specify in the sheet) should start at row 5 and end at row 203 and specific exactly which columns I would like transferred. How might I do that?

Thanks for the help!

Edit: There is unrelated data below row 203 and I don’t want that to be taken. There are also blank columns, so I need to avoid those.

  • 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-05-23T01:37:43+00:00Added an answer on May 23, 2026 at 1:37 am

    First off, save your excel sheet as CSV.

    Next. Create a blackhole table to read the data into:

    DROP TABLE IF EXISTS `test`.`import_excel`;
    CREATE TABLE  `test`.`import_excel` (
      `A` int(10) unsigned NOT NULL,
      `B` varchar(45) NOT NULL,
      `C` varchar(45) NOT NULL,
      `D` varchar(45) NOT NULL,
      `E` varchar(45) NOT NULL,
      .....
      `BB` varchar(45) NOT NULL
    ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1;
    

    Create a simple counter table with just one row.

    DROP TABLE IF EXISTS `test`.`counter`;
    CREATE TABLE  `test`.`counter` (
      id int(10) unsigned NOT NULL PRIMARY KEY,
      `count` int(10) unsigned NOT NULL,
      `max_count` int(10) unsigned NOT NULL
    ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
    
    REPLACE INTO counter VALUES (1,0,(203-5));
    

    Create a trigger on the blackhole table

    DELIMITER $$
    
    CREATE TRIGGER ai_import_excel_each AFTER INSERT ON import_excel FOR EACH ROW
    BEGIN
      DECLARE rows_left integer;
    
      SELECT max_count - (`count` + 1)  INTO rows_left FROM counter WHERE id = 1;
      IF rows_left > 0 THEN BEGIN
        //count the row_number you're in.
        UPDATE counter SET `count` = `count` + 1 WHERE id = 1;
    
        //Interpret the data and insert it into the proper tables.
        //This is just an example
        INSERT INTO real_table (a,b,c) VALUES (new.a, new.b, new.c);
        INSERT INTO real_table2 (a,b,c) VALUES (NULLIF(new.d,''), new.e, new.c);
        //You can change the data in anyway you like.
      END; END IF;
    END $$
    
    DELIMITER ;
    

    Finally import lines 5 to 203 into the import_excel table.

    LOAD DATA INFILE 'c:/excel.csv' INTO TABLE import_excel 
      FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
      LINES TERMINATED BY '\r\n'
      IGNORE 4 LINES;
    

    The first 4 lines will be ignored by the LOAD DATA INFILE the last lines will be stripped out by the trigger.

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

Sidebar

Related Questions

I have a relatively complicated generic type (say Map<Long,Map<Integer,String>> ) which I use internally
I have a relatively simple form which asks a variety of questions. One of
I have written an Excel VBA macro which imports data from a HTML file
I have a somewhat complicated assortment of tables for which I need to do
A relatively simple question. I have a datagridview, which all it does is displays
I have a custom TreeView for which I'd like to hide the ImageList dropdown
I have a relatively simple site that I'm working up for an intranet environment.
We have are relatively simple Reporting Services report that our users commonly export to
I have a relatively complex .htaccess file to control page requests, this currently redirects
I have a relatively simple select statement in a VB6 program that I have

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.