Search code examples
sqlexcelinsertdbm

How do I import and Excel Spreadsheet into my DB?


Hi Everyone, I'm trying to import some data from an excel sheet across three different tables, and I'm wondering how I can do this I can't find anything for actually importing in excel. I don't know how to write an intelligent INSERT for this. HELP!

This is my table structure.

Jobs { [id] [entity_id] [round_id] [company_id] [address_id] [vendor_id] [first_service_date] [name] [price] [type] [status] [notes] [vendor_sort_id] [subcontractor_sort_id] [job_type_id] [auto_complete] [aworka_slug] [deleted_at] [created_at] [updated_at] [use_fixed_price] [fixed_price] [store_code}[last_service_date] [is_credit_note] }

Frequency_Rule_Job{ [id] [job_id] [frequency_rule_id] [effective_from] [created_at] [updated_at] [deleted_at] [is_active] }

Frequency_Rules { [id] [freq] [interval] [week_days] [company_id] [text] [created_at] [updated_at] [json_week_days] [setpos] [count] [deleted_at] }

Here is example data

Jobs enter image description here

Frequency_Rules ![enter image description here

Frequency_Rule_job enter image description here

This is the excel data I'm trying to mass insert.

enter image description here

Edit: Forgot to add that my DB is MySQL


Solution

  • If your database is Microsoft SQL server, create a SSIS(SQL Server Integration Services) project and insert your excel data to database as you want.