Is it possible to convert Excel spreadsheets into MediaWiki markup? I stumpled upon strange recommendations exporting to HTML and convert it into markup. Is there a solution, maybe exporting to XML first or directly converting it?
I know of three options:
- Install a WYSIWYG editor extension like FCKeditor (see also Official). Advantage: fairly easy Paste As Word (and therefore also as Excel) button. Disadvantage: installation can be tricky.
- Use a macro in Excel. Advantage: a one-click creation of markup. Disadvantage: client-side solution (so need it for all users).
My preference is the FCKeditor option because once it is installed it works pretty well.
You can do this in a graphical interface, with proper software.
- Install LibreOffice and add the "wiki publisher" extension, often contained in a package named libreoffice-wiki-publisher.
- Open your spreadsheet with LibreOffice Calc, copy your table.
- Open a new Writer document, paste with Edit > Paste special (RTF style).
- Find "Export" in the menu, select "MediaWiki (txt)" in the format dropdown and confirm.
- (Optional.) In your preferred text editor, remove any excess table HTML markup with a couple of simple text replacements and replace the first line
{|
with{| class="wikitable"
to have pretty backgrounds and borders.
LibreOffice is free/open source software and is better than Excel at handling Excel's own spreadsheets, as you see. There used to be an Office plugin too but I've not heard of anyone using it recently.
You may need table styles, available in LibreOffice 5+; but in the meanwhile you can just apply CSS classes to your MediaWiki table.
Alternatively, just copy and paste your table in a page powered by VisualEditor, which is quite good for tables. If your wiki doens't have it, you could still use the VisualEditor demo: paste, click "source", cut the wikitext and paste into your wiki.
Here is a simple python script that I threw together for my needs. This doesn't handle cell formatting or anything of that nature, but if you just need to get a large table into the MediaWiki format, it'll do the trick. It depends on xlrd.
Usage of this script is as simple as
python xl2wiki.py input.xls
If you want to save the output to another file, just do
python xl2wiki.py input.xls output.txt
My port of Shan Carter's Mr. Data Converter now supports the Wiki table format. You can copy & paste directly from Excel or from a CSV file.
MediaWiki supports HTML syntax for tables. The wikitext doesn't look nice and is harder to edit, but if you are just going to copy&paste anyway, it works. And there should be plenty of tools for converting from Excel (or CSV, ODS) to HTML.
Damn, I should find the time to add native CSV supprot to MediaWiki.
This online convertor does not upload your data so it protects your confident/sensitive data. I've tested it without network connection. It supports different delimiters and direct pasting from Excel.
I use this Excel macro.
You can download the Excel file to your computer, paste your table on it, click the button and paste the formatted text into your wiki.
Here are a few features:
- Export an Excel table to wikimedia format.
- Both horizontally and vertically merged cells are well managed.
- The output text is padded with spaces so that all the columns have the same width (with the exception of the columns with merged cells).
- Bold cells are headers, other cells are normal cells.
There is also a little converter in .net. A small executable:
https://sourceforge.net/projects/csv2other/?source=navbar
It takes in input both CSV or Excel files.
Limit: it only works on the first page of the excel document.
I use this macro available on the main Wikipedia site.
It convert the Excel tables to wiki formating. The output is pretty close to the original excel file. it does transfer font formating and cell colors. There is limitation on the borders but they come from mediaWiki system.
You can find the Code at : https://de.wikipedia.org/wiki/Wikipedia:Technik/Text/Basic/EXCEL-2003_Tabellenumwandlung_VBA
You could export your Excel document to CSV and import it into this web application:
https://www.tablesgenerator.com/mediawiki_tables
You can then edit the table and export it directly into MediaWiki format.
来源:https://stackoverflow.com/questions/3457468/convert-excel-documents-to-wiki-markup