Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-25 14:43:20

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Convert tabular data to textile

Hi

I wonder if it is possible to convert a tabular data (from sheet app like excel or oo calc) to textile easily?

What i do now is : export tabular data to txt file using “|” as delimiter and add the “|” at the begining and end of each line + adding some extra info like CSS, …

Is there a better way to do that?

Thanks

Offline

#2 2009-02-25 17:50:49

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Convert tabular data to textile

What you’ve described is pretty easy, assuming a text editor for a quick grep to add the “|” at the beginning and end of each line. You could skip out the export step and do a simple copy and paste from the spreadsheet into the text editor, then replace the tabs with “|”. Of course there are various ways one could go about scripting the whole thing to make it even quicker, which might be worth doing if you are doing this conversion frequently.


Code is topiary

Offline

#3 2009-02-26 13:34:57

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: Convert tabular data to textile

Ok , then there is no quick and easy solution (:(

What i am thinking is some script (php or javascript) that convert tabular data into textile using a template to assign some styling (ex: ad _. for the first line, center the content of the third colonne, …) , it s only an idea but if i have time i will try to do it, cause it s boring to do manually that (i have 20 table sheet to convert).

NB: by the way it s easy to have tabs at begining and end of data : copy an empty column at the begining and end of data. thanks for the begining of tips.

Offline

#4 2009-02-26 19:43:12

gerhard01
Plugin Author
Registered: 2006-12-07
Posts: 108

Re: Convert tabular data to textile

Ok , then there is no quick and easy solution (:(

There is – use metapad as a texteditor (as jsoos suggested), load your file, hit ctrl+R, enter “\t” and “|”, hit “Replace all” and save your file.

That takes you 30 sec per file, and 10 min for your 20 files – definitely faster than writing a script. But of course this is a “no-brainer” solution while a script is intellectually more challenging ;-).

Last edited by gerhard01 (2009-02-26 19:43:39)

Offline

Board footer

Powered by FluxBB