Convert monospace text to table with 1 figure pro cell

How to convert a monospaced text table (see image below) to a spreadsheet-table with only one figure or empty space in each cell?
image

PLEASE, attach real examples (here as .odt files).
Any contributor can then easily check his (f/m) first and second idea.
ONLY attach an image (from screen) if you question is explicitly about an issue of the view.

Below an expanded table (as it can have also letters and other signs). Now it must become a spreadsheet-table of 17x6 cells. But if it can help let’s say it doesn’t have *.
CourierNew.odt (11.0 KB)

You can use Ctrl+H for example in Writer to your monospace text. Check regular expressions and
Find: (.)
Replace: $1Ă·
÷ is some special character you haven’t in the text. Then Ctrl+A/C, open Calc and menu Edit/Paste Special/Paste Special → Use text import Dialog. And check Separated by → Other → ÷

1 Like

Hi Kamil,
every blank space and period has to have 1 cell.
There are also three blank spaces between the left and the right table. Ideally we should have a spreadsheet table with 15 columns and 5 rows with 3x5+12=27 empty cells. I need it for a huge table, the image is only an illustration.

The written way replaces every character to character÷ including the spaces. And ÷ is the separator for Import in Calc. I don’t see the problem. But if there is some problem, I need some your example data to test, can you upload ODT with example data and not only printscreen?

Below an expanded table (as it can have also letters and other signs). Now it must become a spreadsheet-table of 17x6 cells. But if it can help let’s say it doesn’t have *.
CourierNew.odt (11.0 KB)

I used my way and got the empty column I in Calc. It is possible to add empty columns via Sheet/ Insert Columns.




2nd way is use the Block Selection in Writer (press Alt and select column between tables with mouse; or Edit/ Selection Mode/ Block Area). Then Ctrl+H and check Current Selection only and replace space to three space.
img2
Then use written way to import to Calc.

Yes. Your (OP’s) example file clearly shows that @KamilLanda was right. Your “table” isn’t a table in the sense the term is used when talking about text documents, but an imagined table still lacking the horizontal separators.
You should get the expected result exactly as the esteemed colleague suggested.
exampleInReturn.ods (11.5 KB)

I don’t understand how to Find “any character or space” and Replace with “any character or space + * (or another sign)”. Do you use a “wildcard” for “any character”? The rest of the conversion with * (or other sign) as separator is clear for me.

Ok I got it with (.) and $1* (using help of Libre Office).
(.) as any character, $ as the end of a string, then 1 must be a string of 1 character.
Thanks Kamil and Lupp.

$ is end of string in Find: box.
But in Replace: if it is with number like $1, $2, $3 it means back reference to the expressions from Find: that are in brackets ().
So the expression (.) is: find one character. And the $1 in Replace: is: take the found characters from first brackets () from Find:.
If there is only $ without number in Replace:, then it is only raw character $ :slight_smile: .

You can use csv-import (rename your file to name.csv before) and set the column-widht by clicking on the ruler at the top - the red dots mark the separators. For my test-file I append a picture (german GUI, but I guess you recognize the settings).

2 Likes