Do i need a macro to make a csv (two-values-per-line) multicolumn?

I have a large csv file with the following format of 2 fields per line :

2,a
40,b
12,c
34,b
14,b
27,d

Using Calc, I would like to have the second value as a column header so that column b would contain these rows - empty,40,empty,34,14,empty and column c would have only row 3 containing 12.

Thank you.

(Edited by @Lupp for better readability. Hopefully there wasn’t every other row meant to be empty.)

You missed “2 in A1, rest of column A empty”.

Without a macro, this is also not difficult. Add a line of headers, add a column of line numbers, create a pivot table, take the necessary cells and save as a new CSV file

SeparateByColumns.gif

There are no ready-made tools for such a highly specialised task. Thus:
Doing it by formulae using standard functions and operations (spreadsheet-do) would require to prepare the respective formula in every single cell of the range where probably a dislocated value is to be expected.

Doing it with formulae based on a user function pushing the data by side-effects would
-1- violate one of the principles of spreadsheets
-2- require to enter the respective formulae either in an extra sheet or in the importing sheet, to activate them after the import, and to disable them later.

Doing it with a user Sub explicitly called should be the better way concerning the above statements.

For a very primitive (inflexible) way to do it, you will need about 25 lines of BASIC code.