How to convert Excel spreadsheet to Trac Wiki spreadsheet format?

I saw converters and paste converters in MediaWiki or HTML format. But I could not find one that converts to the WikiFormattting format in the Trac Wiki, which uses channels to separate cells, for example:

||Cell 1||Cell 2||Cell 3|| ||Cell 4||Cell 5||Cell 6|| 
+4
source share
3 answers

You can save your Excel sheet as a CSV file. Then from the command line (assuming that you are using Windows XP or later), enter the following 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 the number of columns. You can make up to 26 columns this way in one pass by increasing the number of tokens and adding the appropriate number of variable names% d,% e, etc.

+6
source

I did jsFiddle to do this, just put your CSV test in the HTML field and run the script, the content that you paste into the TracWiki page will be in the Result field.

In case something happens with jsFiddle, here is the JavaScript I used (I probably didn't need to use jQuery, but it was faster for me to think about how to do non-jQuery:

 var csv = $('body').html().trim(); csv = csv.replace(/,/g, "||"); csv = csv.replace(/$/gm, "||<br />"); csv = csv.replace(/^/gm, "||"); // set to false if you don't want empty cells if (true) { while (csv.indexOf("||||") > -1) { csv = csv.replace(/\|\|\|\|/g, "|| ||"); } } $('body').html(csv); 
+1
source

My port is Shan Carter Mr. Data Converter now supports Wiki in the format you specify. You can copy and paste directly from Excel or from a CSV file.

http://thdoan.imtqy.com/mr-data-converter/

UPDATE: I added Trac-specific formatting to the "Trac" option.

+1
source

All Articles