Page 1 of 1

import/export xls file

Posted: Wed Jul 10, 2013 5:44 pm
by tal
Hi everyone,

I was a revolution studio developer, i havent touch runrev for 4 years, now its livecode and it seems quite the same.

to begin I have a work to make on livecode now, its easy to do but i have my first problems...

I want a software that import a file as input (xls file) and then export a file (.xls) which contains only few informations from the orignal file (filters)

i have put that file as attachement, i want to extract the column "reference de la commande" and the column "montant d'origine", with only the values filtered by : reference de la commande does not begin with "REF" and contains at least 14 characters.

To make it, I imported the file in a field in livecode, but when i try to access the column "reference de la commande" doing : " the item 4 of line 1 of field "myfield" it doesnt work, i have put the itemdelimiter to " ".
If you wanna understand easier what i am saying you should try.

It will be greatful to show me how you manage that little software, it will be a first step for me to remember me this good software and to progress faster.

Thanks all

Re: import/export xls file

Posted: Wed Jul 10, 2013 5:59 pm
by Klaus
Hi Tal,

Livecode cannot use XLS files out of the box, since this is a proprietary file format!

Two possible solutions:
1. In EXCEL export the data in CSV or TAB delimited text format, which you can use immediately in Livecode
or
2. you need a 3rd party lib for Livecode, this one:
http://curryk.com/Spreadlib02001.zip
But I think the full version is not free!

Hope that helps!


Best

Klaus

Re: import/export xls file

Posted: Wed Jul 10, 2013 6:10 pm
by tal
Ill check it tomorrow, can you remind me what is the command to allow the user to open a file to import?

And is there a function or a library in livecode to convert a pdf file into text, so i can manipulate the datas.

Thanks

Re: import/export xls file

Posted: Wed Jul 10, 2013 6:23 pm
by Klaus
Hi Tal,
tal wrote:Ill check it tomorrow, can you remind me what is the command to allow the user to open a file to import?
Yes :-)
tal wrote:And is there a function or a library in livecode to convert a pdf file into text, so i can manipulate the datas.
Nope, also not out of the box!

Maybe there are some command line tools that you can use with SHELL()?
Sorry no idea...

Best

Klaus

P.S.
Ah:
...
answer file "Select a file:" with type "Livecode|livecode,rev,mc|"
put IT into tSelectedFile
## Do whatever you line with tSelectedFile
...
:-D

Re: import/export xls file

Posted: Wed Jul 10, 2013 10:05 pm
by Newbie4
Export your data as a tab-delimited file, then read it into LiveCode.

Code: Select all

 put URL ("file:" & tFileName) into myData
Then you can either work with it as a text file, put your data into an array or put it into a Datagrid. Whatever you feel most comfortable doing. It will not be a difficult task.