Ask Your Question
0

Disable prompt when opening a CSV file [closed]

asked 2014-02-04 17:13:58 +0100

Knocks gravatar image

updated 2015-08-29 21:26:38 +0100

Alex Kemp gravatar image

Every time I open a CSV file, LibreOffice presents me with a prompt asking to confirm Character Set, Language, and Separator options (tab, comma, semicolon etc). This prompt is not present in Microsoft Office, and I find it unnecessary, because all my CSV files are just that--comma-separated value files. The time wasted on addressing this prompt as I open dozens of CSV files every time, and I get a prompt every single time.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-03-04 20:19:17.363611

4 Answers

Sort by » oldest newest most voted
0

answered 2014-02-04 18:36:44 +0100

gagrilli gravatar image

CSV files have much more varieties than one would suspect from the name. In particular,the separator might include a <tab> , or other character (printable or not), the data could include numeric values with decimal or thousands separator, the text could be in several different lanuages and/or locales and so on. </tab>

Finally remember that Libreoffice is an international project. As such it should honour the fact that different countries use the comma or the semicolon for different purposes.

Hope you understand why there are so many options in the import dialog.

If you like to do some reading, the process of importing CSV files can be automated, using the command line. You can specify some variables in the command line to enforce particular options. The most difficult IMHO to grasp are the so-called filter options.

Alternatively, you might try using a macro fortheimport process. The Libreoffice mailing list, as well as the, older, Openoffice forums contain useful information, which might guide you towards a simple and fast solution.

Hope this helps.

edit flag offensive delete link more

Comments

Most software we use today is international. That doesn't mean you should choose your language every time you start it up. I know what my preferred settings are, and there should be a way for me to tell the program what those preferences are. That's the very definition of preferences.

Knocks gravatar imageKnocks ( 2014-02-04 19:10:34 +0100 )edit

The reference to "international" is for the CSV source, not the Libreoffice preferences. Other countries use different symbols for the separation of the fields. How does LibreOffice knows that?. Remember, the CSV does not have ANY extra information whatsoever.

And as for a way to automate it, there is. You might try to search a bit. Yes, it is a bit difficult to provide a dialog-free import for CSV, but it does not mean that if by default LibreO supresses the dialog, the result is better for the end user! Other users find the options useful.

These links might provide some routes:

http://manpages.ubuntu.com/manpages/raring/man1/doc2pdf.1.html

https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options

gagrilli gravatar imagegagrilli ( 2014-02-04 19:44:22 +0100 )edit

You are answering questions that no one is asking. No one said the dialog should be suppressed by default. The dialog should be suppressed if the user thinks it would be better for him. Again, that's what "Preferences" are for.

And using a 3rd party utility via command line to suppress a dialog would be a gigantic fail. That's the reason people avoid free office software. If those are the options you're offering to an average user, then sticking with Excel is a better choice.

Knocks gravatar imageKnocks ( 2014-02-04 20:31:19 +0100 )edit

"The time wasted on addressing this prompt as I open dozens of CSV files every time, and I get a prompt every single time." Correct me if I'm wrong but you seem to ask for a way NOT to address this prompt, in order to import CSV files. These links point to 2 possible ways. Yes, they need a bit of work, but not too much. This is what I did, when i faced the same situation. Your mileage or dedication may vary.

And, by the way, if you bothered to read enough into the pages, you would see that the options are there for every user. That's what "choice" is for. Are you suggesting that every aspect of the suite should be "suppressable" (where it counts, of course), if the user thinks it would be better for him? And how then can another user have his own ...(more)

gagrilli gravatar imagegagrilli ( 2014-02-05 01:43:12 +0100 )edit

Macros and filters? This is the 21st century. Excel (also international) seems to work fine without them.

Users who find the dialog useful probably open less than a half dozen csv files per year. If you have programs that output to a csv file and then ends with system("abc.csv");, which you run 10-20 times daily, you may find the dialog a little annoying. This process has worked extremely well for me over the past 10 years with excel (without the dialog).

My preferred solution is to run the dialog once, the first time a csv file is opened. Subsequent calls suppress the dialog. Provide an option to set defaults within calc and use those until changed. Another solution is to have a command line switch -d which when null forces a dialog, otherwise if , or : or '\t', etc., use as delimiter. You could also combine the two solutions.

Phiippe gravatar imagePhiippe ( 2014-02-22 20:15:13 +0100 )edit
0

answered 2014-02-05 01:26:17 +0100

ROSt52 gravatar image

Reading all the interesting explanations given here, I would like to add 2 comments:

1 - @Knocks - may I suggest you take the hint in @petermaus's answer:

It would be interesting to be able to specify all these options on the first file and then say use these options on selected set. I would be interested if this could be automated through a batch command.

write an enhancement request using the BSA and publish the bug number here to allow others to add comments.

2 - I like and need the very many CSV import options Calc is offering, but I also would prefer if default option could be customized thus would support an enhancement request.

edit flag offensive delete link more

Comments

@ROSt52 Per your suggestion I have filed a report about this issue: https://www.libreoffice.org/bugzilla/show_bug.cgi?id=74580

Knocks gravatar imageKnocks ( 2014-02-05 19:39:42 +0100 )edit

This does seem like an obvious and easy problem to resolve--as stated above, and elsewhere, simply create an option to open with whatever default character set the user has chosen--that's what options are for. I uninstalled OpenOffice because of this, hoping LibreOffice would have made this obvious fix. After years of having to use OpenOffice to open dbf files for QuantumGIS, and always getting the same stupid prompt for every file I have to open, I have never once not just clicked Enter

jtownsle gravatar imagejtownsle ( 2017-10-26 18:02:34 +0100 )edit
0

answered 2014-10-06 14:29:09 +0100

kwoid gravatar image

updated 2014-10-08 09:41:25 +0100

This macro opens the file open dialog, where one can select an existing file. This file is then opened by the CSV-Filter with given defaults concerning encoding, delimiter etc. It's easy to get the properties specification, using the record macro feature and record a macro while a save-as-procedure.

Sub DDICSVopen
dim aUrl(), s$
Dim vDoc 'die geladene Komponente
Dim Arg()
dim fileProps(1) as new com.sun.star.beans.PropertyValue
fileProps(0).Name = "FilterName"
fileProps(0).Value = "Text - txt - csv (StarCalc)"
fileProps(1).Name = "FilterOptions"
fileProps(1).Value = "44,34,76,1,,0,false,true,true,false"
oDlg = createUnoService("com.sun.star.ui.dialogs.FilePicker")
oDlg.setMultiSelectionMode(false)
oDlg.execute
aUrl = oDlg.getFiles()
'Messagebox for debugging
's = "file:" & chr(10) & aUrl(0) & chr(10)
'msgbox s
vDoc = StarDesktop.loadComponentFromURL(aURL(0), "_blank", 0, fileProps())
End Sub

This answer is borrowed from a similar question.

edit flag offensive delete link more

Comments

How can I use/register your macro so it starts automatically?

sebns gravatar imagesebns ( 2015-12-29 15:05:14 +0100 )edit
0

answered 2014-02-04 18:39:14 +0100

petermau gravatar image

Yes, I can see you would be frustrated if you have lots of files to import.

A CSV (comma-separated values) is also sometimes called character-separated values file because fields do not have to be separated by a comma, mine usually are not. CSV is a very old (1967) text file pseudo standard and you can read and create the files using a standard text editor. Hence it is not possible to automate the identification of the information. This is why LibO Calc gives you an import menu to define and check the import "delimiters" and see that the formatting is correct. I understand that Excel has a multiple screen Excel Text Import Tool to allow you to import CSV files if you have "problems" with any of your files.

How were the CSV files created? Do they all come from the same source, use the same delimiters, character sets, languages, decimal separators, text delimiters? Is there another choice of data interchange you could use.

It would be interesting to be able to specify all these options on the first file and then say use these options on selected set. I would be interested if this could be automated through a batch command. Sorry not to help further..Peter

edit flag offensive delete link more

Comments

All the files I'm working with come from the same vendor and use the same delimiters, charsets, etc. There is no other choice as to the format. LibreOffice should allow the user to suppress this prompt as an opt-in, so the user knows what he's getting into. I should be able to double-click on a plain CSV file and open it. If Excel can do it, so should LibreOffice.

Knocks gravatar imageKnocks ( 2014-02-04 19:07:43 +0100 )edit

Sorry, but no.. If Excel imports in the wrong way, so should LibreOffice?. Again ther is no notion of a "plain" CSV file. And yours is NOT plain to begin with

gagrilli gravatar imagegagrilli ( 2014-02-04 19:28:20 +0100 )edit

You don't have to put down Excel every time you need to prove a point. In this instance, Excel does it correctly. In the U.S. version of Excel, commas are the default delimiter. In certain foreign versions, the semicolon is the default.

But I'm not even suggesting a default here. Do you know the meaning of the phrase "opt in"? The user should be able to opt in and say "Leave me alone, I know what the delimiters are."

Knocks gravatar imageKnocks ( 2014-02-04 20:42:35 +0100 )edit

Question Tools

2 followers

Stats

Asked: 2014-02-04 17:13:58 +0100

Seen: 5,257 times

Last updated: Oct 08 '14