Frequently asked questions - Calc
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
How do I open a text file containing separate fields in a spreadsheet? What if there are different field separators?
Importing data from a text file can have variable results depending on the parameters selected in the Text Import dialog. If you do not know how the data is encoded or separated in your file, double check the preview of columns shown at the botton of the dialog.
If your text file does not have .csv or .txt extension, rename it (preferably as .csv).
- Go to ▸ .
- In the File Type box, select: Text CSV ( *.csv; *.txt). (Note: This choice is near the bottom of the list).
- Navigate to your text file and select it.
- Click on Open.
- In the Text import dialog select the correct parameters:
- Character Set (legacy ASCII is nowadays rather to be UTF-8)
- if there is a separator: choose Separated by and then enter the appropriate separator(s); and deselect any other separators (LibreOffice tends to select several by default)
- if the columns are fixed width: select Fixed Width and position the column dividers in the preview
- If you are importing dates or timestamps:
- select Detect Special Numbers
- at the top of the relevant columns click on standard and select Date instead
- Select D/M/Y OR M/D/Y as appropriate
- If some or all text fields are surrounded by quotes, select the appropriate Text Delimiter
- If you are importing a data file from a stock control system, it is highly probable that the decimal separator will be a dot. In this case set the language to English (US).
If you want to combine several text files into a single sheet, follow this procedure:
- Open an empty spreadsheet.
- Go to ▸ .
- Select the File Type that you want (Text CSV .txt, dbase, etc.)
- Search for the file you wish to open.
- Click on the Insert button to close the window.
- Set the parameter in the Text import window as shown above.
- Click OK.
- Repeat the procedure from 2) for the other files.
Note: If you check the Link box, the sheet will be linked when you open your spreadsheet, and you will be asked if you wish to update the link. Just click OK.