[Solved] Load XLS file having tab separated data

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Lovepreet323
Posts: 22
Joined: Fri Jun 17, 2022 9:45 am

[Solved] Load XLS file having tab separated data

Post 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
Last edited by Lovepreet323 on Fri Nov 01, 2024 10:27 am, edited 2 times in total.
OpenOffice 4.0 on Windows 10
Bidouille
Volunteer
Posts: 599
Joined: Mon Nov 19, 2007 10:58 am
Location: France

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

Post 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?
FJCC
Moderator
Posts: 9432
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

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

Post 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())
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Post Reply