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.
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 MediaWiki.org sandbox: paste your rich text, click the pencil button at the top and then "wikitext/source editing", 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
MediaWiki 支持表格的 HTML 语法。维基文本看起来不太好,也更难编辑,但如果你只是要复制和粘贴,它就可以了。并且应该有很多工具可以将 Excel(或 CSV、ODS)转换为 HTML。
该死,我应该找时间向 MediaWiki 添加原生 CSV 支持。
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.
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.
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.
发布评论
评论(7)
您可以使用适当的软件在图形界面中执行此操作。
{|
替换为{| class="wikitable"
拥有漂亮的背景和边框。正如您所见,LibreOffice 是免费/开源软件,在处理 Excel 自己的电子表格方面比 Excel 更好。曾经也有一个 Office 插件,但我最近没听说有人用过。
您可能需要表格样式,在 LibreOffice 5+ 中可用;但与此同时,您可以将CSS类应用到您的MediaWiki表格。
或者,只需将表格复制并粘贴到由 VisualEditor< 提供支持的页面中/a>,这对于表格来说非常好。如果您的 wiki 没有,您仍然可以使用 MediaWiki.org 沙箱 :粘贴您的富文本,单击顶部的铅笔按钮,然后单击“维基文本/源编辑”,剪切维基文本并粘贴到您的维基中。
You can do this in a graphical interface, with proper software.
{|
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 MediaWiki.org sandbox: paste your rich text, click the pencil button at the top and then "wikitext/source editing", cut the wikitext and paste into your wiki.
我的 Shan Carter 的 Mr. Data Converter 端口现在支持 Wiki 表格式。您可以复制并直接从 Excel 或 CSV 文件粘贴。
http://thdoan.github.io/mr-data-converter/
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.
http://thdoan.github.io/mr-data-converter/
这是一个简单的 python 脚本,我根据自己的需要将其组合在一起。它不处理单元格格式或任何类似性质的内容,但如果您只需要将一个大表转换为 MediaWiki 格式,它就可以解决问题。它取决于 xlrd。
该脚本的使用非常简单,
如果您想将输出保存到另一个文件,只需执行以下操作
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
If you want to save the output to another file, just do
MediaWiki 支持表格的 HTML 语法。维基文本看起来不太好,也更难编辑,但如果你只是要复制和粘贴,它就可以了。并且应该有很多工具可以将 Excel(或 CSV、ODS)转换为 HTML。
该死,我应该找时间向 MediaWiki 添加原生 CSV 支持。
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.
我使用维基百科主站点上提供的此宏 。
它将 Excel 表格转换为 wiki 格式。输出结果与原始 Excel 文件非常接近。它确实传输字体格式和单元格颜色。边界有限制,但它们来自 mediaWiki 系统。
您可以在以下位置找到该代码:
https://de.wikipedia.org/wiki/Wikipedia:技术/文本/基本/EXCEL-2003_Tabellenumwandlung_VBA
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
现在已经是 2021 年了。
您可以将基本的 Excel 电子表格直接复制到 MediaWiki 的可视化编辑器中。
复制/粘贴方法唯一缺少的是单元格格式。
It's 2021 now.
You can copy basic Excel spreadsheets directly into MediaWiki's Visual Editor.
The only thing that's missing in the copy/paste method is cell formatting.
我知道三个选项:
我更喜欢 FCKeditor 选项,因为一旦安装它就可以很好地工作。
I know of three options:
My preference is the FCKeditor option because once it is installed it works pretty well.