Deductions & credits

In TurboTax, the process is easy.

First, enter your original data (the code W amount in box 12 on your W-2 - if any).

Then, in the HSA interview (Federal->Deductions & Credits->Medical->HSA, MSA Contributions) answer the questions and add any contributions you made directly to the HSA not through your employer.

TurboTax will then detect the excess contribution and ask you if you will withdraw it before the due date of the return. You will answer "yes" because you have already done it. Then TurboTax will add it back to line 21 (Other Income) so that you can be taxed on it.

Next year, you will receive a 1099-SA with the excess and the earnings, and the earnings will be added to your 2018 tax return as other income.

NOTE: when you withdraw the excess, did you tell the HSA administrator that this was an "excess contribution" that you were withdrawing? Otherwise, they may have made it a "distribution" which, since it was not used for medical expenses, would end up hitting you with penalties.