Crazy Cucumber
Crazy Cucumber

Reputation: 479

Update SQL server table from an Excel file

I went through a few links and some questions on Stackoverflow and nothing seems to help.
I tried this but I do not have Get & Transform ribbon in my Excel.
I tried this but I do not have Query Editor ribbon in my Excel.

I have an Excel spreadsheet with 300+ rows that needs to be added to a SQL Server table.
My table needs to be unpivoted first. For e.g.,

This is my current format on Excel:

enter image description here

I want it to look like this:

enter image description here

The columns become attributes and the corresponding rows become their values. Once that is done, I want to insert this "unpivoted" table to my SQL Server table.

I already have a table in place with some information. I need to update that table with these values. Just push this whole thing in there.

For the sake of this problem, let's assume that all the variables are nvarchar(50).

Any guidance would be appreciated.

Thank you.

Upvotes: 1

Views: 10456

Answers (1)

Crazy Cucumber
Crazy Cucumber

Reputation: 479

Sorry guys. Just a little bit of fooling around and the nudge from @Ralph helped me figure this out.
Right click the database -> Tasks -> Import
Go through the wizard. When it asks for source and destination files, I selected the Excel sheet as source, Clicked on Edit Mappings and clicked on Edit SQL button.
Now I can edit the query to make it do what I want to do.
Thank you.

Upvotes: 1

Related Questions