How to set up FilterOptions to open/import a CSV file?

Yep!

It was my lack of attention. Thanks!

Your ‘Value’ is containing 16 tokens while there are “only” 5 I know of .
The first token 59/9 qualifies the semicolon and the HT as the field (column) separators used.
The second token 34 defines the usual doublequote as the text delimiter.
The third token (9 in your case) should describe the character set. I would suggest you better use 0 (‘system’). The supposed meaning of 9 I don’t know. Typo?
Fourth token 1 is OK if you want to start the import with the first line.
Fifth token is rotten. You may mean 1/10/2/4/3/9/4/1/5/1/6/9/7/1/8/1/9/1 where I don’t understand for what reason you use 1/10 (first column: override locale by US), and want to ask if you actually want to NOT import the third and the sixth column. (The fifth column is a lot of html. Do you want that?
The tail , 0, false, false I don’t understand at all. It doesn’t relate to any setting I would know of, but there may have been enhancements I missed.
Cf. Subchapter 12.4.6. Loading and saving documents of Andrew Pitonyak’s “OpenOffice.org Macros Explained”.

1 Like

I’m still learning how to program in Basic.

Now I see that it was a newbie’s mistake. hahahaha

Actually, I used this macro just for study. I intend to integrate this macro in another one.

The valeu 9 in the third token was because in the Character Set Table, the index correspond to default system.

The first column in the fifth token would be because the first column correspond to numbers. However, with you asking, I understood that I can put 1/1, due to the seventh token.

The tail 0, false, false,
matches with language (token 6), quoted as text field (token 7), and detect special numbers (token 8), respectively.

I’ll use it to import a file and format it.

Thanks for the help @Lupp !

I’m sorry, I almost forgot.
The Csv file which I’ll work has HTML tags in the information described, in the fifth column, to facilitate visualization of important information, and make reading more agile to the end user on the system.

OpenOffice.org accidentally links to the Open Office main site–Lupp never intending for it to be a site at all. The book referred to by @Lupp is at https://www.pitonyak.org/OOME_3_0.pdf.

1 Like

Thank you!

I understand the note just now. I didn’t use a translator at the time and I got lost in the conversation. My English is pretty rusty.
Sorry!

Import your csv manually with all required options correctly set.
Run the following macro and copy the filter options from a input box.

Sub showFilterOptions
Dim args(),i%
	args() = thisComponent.getArgs
	for i = 0 to uBound(Args())
		if args(i).Name = "FilterOptions" then inputbox "","",args(i).value
	next
End Sub
3 Likes

What do you know about the tail ,0,false,true,true,false,false I get the described way?

Possibly → Filter Options

Thanks! That’s a source I miss to think of much too often. Age?

However: MS_Works_Calc is missing. The import filter still is working flawlessly for me in LibO 7.2.3.2 and also in AOO 4.1.7. It even asks for the character set with the reasonable suggestion (no FilterOptions there). Just tested again with a file from 1994.
Things are strange, and their documentation must therefore also be?
Should I try if the mentoined filter also is usable for export?

Meanwhile Calc CSV import/export knows 13 parameters. Continuing 1-based:

  • token 10: Save cell formulas, export; true if so, default false
  • token 11: Trim spaces, import; true if so, default false
  • token 12: Sheet to export, export; 0 for current or if not present, -1 for all, or 1-based sheet number
  • token 13: Evaluate formulas, import; true if so or if not present, if present default false

For token 12 see 7.2 release notes.
For token 13 see 7.3 release notes.

1 Like

Is there an updated specification somewhere?

Specifications Pissifications Nullifications. This is about free software in a meritocratic project! Anybody contributing anything is right.

StarOffice 8 Programmierhandbuch (German edition, SUN 2005 - very professional, “Teilenr.: 819–1326–01”) mentions FilterOptions, but doesn’t specify or exemplfy a single one.

Even if properly documented, the FilterOption string is so complicated that you may waste time and mental health until you get it right. My little macro does that job for you after you did your job on the user interface (whih is difficult enough).

IMHO, more options won’t help. If “detect special numbers” were the default, most questions on wrong text import would not arise. Before “special numbers” (OOo 2?) people became upset because strings like “2/4” were interpreted as dates. This could be fixed easily importing the offending column as text.

Then someone introduced “detect special numbers” (default: no). Since then the majority of new users imports wrong text because the interpretation of numeric strings would be correct in the vast majority of practical use cases.

1 Like

The macro does a neat job.

For the defaults, new FilterOptions parameters added preserve the behaviour of existing macros that do not know the new options. What is made default in the UI’s import dialog can and may be a different thing.

And yes, documentation should gather all options in one place, preferably the help system.

Which was done for the 7.3 help thanks to Mike and Olivier and tdf#140779.

3 Likes

Thanks a lot to the authors!

If you really want to understand this option string, refer to the method ScImportOptions::BuildString() in the source code file /core/sc/source/ui/dbgui/imoptdlg.cxx

https://opengrok.libreoffice.org/xref/core/sc/source/ui/dbgui/imoptdlg.cxx

And best link to the current and latest CSV filter options help that meanwhile (24.2) knows some new options.