Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert an Excel table into Trac Wiki Table format?

Tags:

markup

wiki

I've seen copy & paste converters to MediaWiki or HTML format. But I could not find one that converts to the Trac Wiki format (WikiFormattting) which uses pipes to separate cells, such as:

||Cell 1||Cell 2||Cell 3|| 
||Cell 4||Cell 5||Cell 6||
like image 826
hopia Avatar asked Feb 27 '23 02:02

hopia


1 Answers

You could save your excel sheet as a CSV file. Then from a command prompt (assuming you are running Windows XP or newer) type this command:

for /f "tokens=1,2,3 delims=," %a in (mycsvfile.csv) do ((echo ^|^|%a^|^|%b^|^|%c^|^|) >> mywikifile.txt)

The number of tokens depends on how many columns you have. You could do up to 26 columns this way in a single pass by increasing the number of tokens and adding the corresponding number of variable names %d, %e, etc.

like image 167
user468649 Avatar answered Mar 10 '23 12:03

user468649