I want to import a text file into Calc and have it appear in the same page format that I see when I open it in Writer.

So I want 80 characters per row in a single column.

I want to take advantage of the Data Grouping function in Calc, which will allow me to click a twisty to hide or reveal rows of data, which in my case will be paragraphs.

I found the following code online. Can I modify this for my purposes? And what kind of code is it? How would I execute it? Sorry for being so helpless. And I had to add newlines in my post to prevent the code from bunching up. I’m new to this forum, so I don’t know all the nuances.

An example of a CSV going into one column,
multiple rows (but note complete lack of
error handling):

Sub Example()
Dim i
Dim sTemp As String
i = FreeFile
Open "C:\MyFile.txt" For Input As #i
n = 0
Do While Not EOF(i)
Input #i, sTemp
ActiveCell.Offset(n, 0) = sTemp
n = n + 1
Loop
Close #i
End Sub

[Edit Opaque] put code to preformatted text

[Edit ajlittoz] removed extra blank lines in code

You can hide sections in Writer, see Help

I couldn’t figure out how to import the text file into a single column, but I did find a sed command that inserts a newline every 80 characters, and that imports sufficiently. Thanks for providing this forum!

Here is the sed command:
sed -e “s/.{80}/&\n/g”

You can export the text file as PDF, open the PDF, select all, copy and paste in Calc.