Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If the file is in *.csv format then you NOT NEED delete columns AFTER load, you can do it BEFORE. Please look this page - Filter Options

With this info your macro will be very small, something like as

Dim sUrl As String
sUrl = convertToURL("C:\FakePath\some_data.csv")
Dim OpenProp(1) as New
OpenProp(0).value="Text - txt - csv (StarCalc)"
If Not FileExists(sUrl) Then Exit Sub
oDoc = stardesktop.LoadComponentFromURL(sUrl, "_blank",0, OpenProp())

In other words, you just need to list the values of "column number / 9 (hidden)" and use this string as the CSV file import filter parameter.

NB Thoroughly check this code on various data - there is a possibility that not all rows will be read into the table (see bug 90653)