Import ASCII text file to LibreOffice Calc

I try to import a space or tab-delimited ASCII text file into LibreOffice Calc, but it opens in LibreOffice Writer instead. How can I import the txt file into LibreOffice Calc?

‘CSV’ text files (“Comma Separated Values”) are classic methods for import/export values for databases, so I thought that there should be a standard import/export method. I was right. The following will work for both Data & Calc, and other characters can be used as the separator (are you still around, Mr Irvine?); it is taken from the Help file:


Opening and Saving Text CSV Files

Comma Separated Values (CSV) is a text file format that you can use to exchange data from a database or a spreadsheet between applications. Each line in a Text CSV file represents a record in the database, or a row in a spreadsheet. Each field in a database record or cell in a spreadsheet row is usually separated by a comma. However, you can use other characters to delimit a field, such as a tabulator character.
If the field or cell contains the separator char, the field or cell must be enclosed by single quotes (’) or double quotes (").

To Open a Text CSV File in Calc

  1. (menu):File|Open
  2. Locate the CSV file
    If the file has a ‘.csv’ suffix then simply select it, but if it some other extension then you also need to select Text CSV in the File type box
  3. Click Open
  4. In the Text Import dialog, specify the options to divide the text in the file into columns
    The bottom of the dialog previews the layout. Right-click a column in the preview to set the format or to hide the column.
  5. Check the text delimiter box that matches the character used as text delimiter in the file (the defaults are: Tab, Comma + Semicolon). In case of an unlisted delimiter, type the character into the input box.
  6. Click OK when complete.

If this helps then please tick the answer (:heavy_check_mark:).

I add just a simple clarification for position 2
If you have a file with extension txt, in the File Type box simply select .
Then select your file file from the list and go on …

If your file has the extension .txt it is by default recogized as a text file and opened in writer. You can rename it to .csv then it will be associated with Calc. Or open the .txt file from within Calc then Calc will recognize it.

@TomIrvine – Did this answer help you out?

From my experience, by “import” you mean to have those data inserted into somewhere in current document. I don’t know how.

Hi @jiero, you are right but in this case I think it just means “open” the file.

Here is a method I found to do this sort of using link to external document:
http://listarchives.libreoffice.org/global/users/msg08407.html

Try this:
Go to Insert | Sheet From File…, browse to your .txt file, and click Insert.
In the Text Import dialogue, under “Separator options”, select “Separated by”, “Space”, and “Merge delimiters”.
Click OK.
In the Insert Sheet dialogue, select the position of your new sheet and - crucially - tick Link.
Click OK.

See if that helps. I wish they did have an import from text file like excel though.