import/export xls file

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tal
Posts: 84
Joined: Thu Jul 02, 2009 3:27 pm

import/export xls file

Post by tal » Wed Jul 10, 2013 5:44 pm

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
Attachments
file.zip
(15.67 KiB) Downloaded 374 times

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: import/export xls file

Post by Klaus » Wed Jul 10, 2013 5:59 pm

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

tal
Posts: 84
Joined: Thu Jul 02, 2009 3:27 pm

Re: import/export xls file

Post by tal » Wed Jul 10, 2013 6:10 pm

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

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: import/export xls file

Post by Klaus » Wed Jul 10, 2013 6:23 pm

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

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: import/export xls file

Post by Newbie4 » Wed Jul 10, 2013 10:05 pm

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.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

Post Reply