Removing line breaks in documents or spreadsheets

Català (Catalan) Español (Spanish)

It’s been a while since I’ve made a post with a technical trick. I always doubt if people will know them and it will look like I’ve discovered garlic soup. In any case, if you already know it, just skip the post and that’s it.

This summer I have been copying a few competences from the decrees of the new curriculum to make the new version of the qViC. The decrees are published in PDF and of course, when copying and pasting them into a spreadsheet or text document, line breaks appear.

A parenthesis. If copied into spreadsheets, it can be worse, as the text appears in several cells.

Here the solution is simple. Instead of pasting the text directly into the cell, it is necessary to paste it into the formula area.
This way we have the text in a single cell.

But let’s get to the point. The pasted text contains line breaks that we do not want. In the case of the example in the image, after questions, the, the, the and the there is a line break that we are not interested in.

How do we remove them all suddenly and automatically?

It is very simple. In the Edit menu you can find the option Search and Replace (or directly with the keys Ctrl+H).

In the dialogue box you only have to indicate to search \n (which is the line break code), which is replaced by a blank space (in the image, logically you can’t see it, but it’s there!) and indicate to search using regular expressions. We can choose whether to do it in all sheets, only in the current one or in a specific interval.

The screenshot is from a spreadsheet, but it is almost identical in text documents. When you press Replace All, the line breaks will disappear and the text will be on a single line.

In the case of spreadsheets, we can use the text wrapping options to decide how the text fits in the cell.

And that’s it, we can easily copy text from PDFs and not have to manually remove line breaks.

Català (Catalan) Español (Spanish)

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.