Page 1 of 1

[Solved] Load XLS file having tab separated data

Posted: Wed Oct 30, 2024 1:31 pm
by Lovepreet323
I have a xls file which have data in csv format. I used "Tab" separator to open it manually.

But using macro multiple columns data opened in 1st column only, separator not working using macro.

If i renamed file to .csv then it correctly opened in multiple columns.

Please advise is there any way to open or load .xls file with separator or any way to rename/ change extention of file to .csv

Re: How to load xls file having tab seperated data in calc using macro

Posted: Wed Oct 30, 2024 3:05 pm
by Bidouille
XLS is not CSV and vice-versa

And since 2022 and the proposals made to you, you haven't been able to make any progress?

Re: How to load xls file having tab seperated data in calc using macro

Posted: Wed Oct 30, 2024 4:07 pm
by FJCC
Here is a macro that should open a set file that is tab delimited

Code: Select all

Dim Propval(1) as New com.sun.star.beans.PropertyValue
Propval(0).Name = "FilterName"
Propval(0).Value = "Text - txt - csv (StarCalc)"
Propval(1).Name = "FilterOptions"
Propval(1).Value ="9,34,0,1,1"   'ASCII  9 = tab 
FileName = "C:\Documents and Settings\username\Desktop\Archivo.txt"  '
FileURL = convertToURL(FileName)
oCSV = StarDesktop.loadComponentFromURL(FileURL, "_blank", 0, Propval())