Currency Exchange Rates

One of the reading says that the borrower’s currency depreciate if there is excess borrowing. I understand this. But then they say as capital flows into a country demand for that country’s currency increases, resulting in appreciation. What am I missing here?

Excess borrowing drives up interest rates, leading to foreign direct investment, and increasing the demand on local currency.