Search code examples
excelpowerqueryspreadsheetunpivot

How to change column/row data into row only data (for db import)?


I don't know much about Excel but I think it may be capable of doing this. I have a large spreadsheet similar to the first image that I need to "spread out" into separate rows for each header column with its corresponding values in one row. So the first spreadsheet basically needs to look like the second spreadsheet (with all the rows, since I only listed the first few). Is there a quick way of this doing in Excel? And apologies in advance for the title to this post. I really didn't know how else to phrase this question. But if someone can come up with a better way to phrase it, I will be happy to change it (if I can do that).

Sheet 1

Sheet 2


Solution

  • If you have Excel 2013/2016 than this is a simple task which can be solved using Unpivot data function inside Power Query Window.

    first, select your table (make sure you give name to your first column), then go to Data ==> From Table

    enter image description here

    You will automatically launch PowerQuery window. from there, select all your columns (you can click on first column (110 column), then scroll to last column and select it while holding SHIFT button). When all columns are selected, goto Transform tab ==> Unpivot Columns.

    enter image description here

    After that, goto Home tab ==>Close&Load.

    enter image description here

    enter image description here