Commons:Convert tables and charts to wiki code or image files
- See also: Template:Table. And: Commons:Chart and graph resources. And: Commons:Create charts and graphs online.
Here are some tools, resources, tips, and instructions for converting tables and charts to wiki code or image files. Most of the tools and resources are free.
Some starting points
[edit]- en:Help:Table. Visual Editor is much improved concerning tables. See section on Visual Editor.
- mw:Help:Table#External links
- en:Wikipedia:Tools#Importing (converting) content to Wikipedia (MediaWiki) format
- en:Wikipedia:Tools/Editing tools#Wikisyntax conversion utilities
- Appropedia:Porting formatted content to MediaWiki
- mw:Manual:Importing external content
- en:Help:Table#Converting spreadsheets and database tables to wikitable format
- Commons:Help desk
- Template:ShouldBeText, for tagging images that should be text.
Sandboxes
[edit]Sandboxes help a lot. For example; your user page: Special:MyPage. Create and bookmark some personal sandboxes too: Special:MyPage/Sandbox, Special:MyPage/Sandbox2, Special:MyPage/Sandbox3. As many as you want. Share the link when asking for help. Wikipedia user pages have Visual Editor enabled by default. But not on talk pages. Visual Editor will load very fast in empty sandboxes. To find all your sandboxes: Special:PrefixIndex/User: - click link, add user name to spot labeled "Display pages with prefix:"
Web table (HTML-based) to wiki code
[edit]See en:Help:Table sections on the Visual Editor first. Most HTML tables can be copied directly off the page into VE. If not, try the methods below that use the actual HTML code.
LibreOffice
[edit]Convert web page tables (HTML-based) to wiki code. You can save any web page as an HTML file, and then open it in LibreOffice Writer. Sometimes you can paste parts of web pages directly into LibreOffice Writer. Continue editing there. Remove non-table stuff for example. Then export it to Mediawiki:
- LibreOffice Writer is free. It can open almost any file format. It can export to Mediawiki. File menu > export > save as type > MediaWiki. It will save the file as a .txt file which can be opened with any text editor. Copy the wiki code from the text file.
HTML to Wiki converters
[edit]- HTML to Wiki Converter. "This is a slightly altered mirror of a script by Borislav Manolov." Hosted at Wikimedia Toolforge on Magnus' tools. See User:Magnus Manske. Enter HTML markup. Retrieve wiki markup.
- HTML to Wiki Converter - tables. By Borislav Manolov.
- HTML WikiConverter. Convert HTML to wiki markup. Various versions and languages.
Other more technical tools
[edit]- Python wikipedia robot framework (pywikipediabot). It can convert HTML tables to wiki code.
Move decimal point of a column
[edit]Or multiply/divide by 10/100/1000/etc
[edit]This is useful for example, when the source table has population in 1000s and you want straight population numbers.
Open up the relevant spreadsheet, or copy the column alone, to LibreOffice Calc. While doing the following do not leave the spreadsheet to go elsewhere while doing this, or it may not work. You will have to start over by correctly copying the cell again.
See: Multiply the numbers of a specific column with a number in libre office.
You must copy 10/100/1000/etc. from a LibreOffice Calc cell on the same page. You can't just copy the number from a text editor, etc.. Enter the number into a Calc cell. Select the cell, not the number in the cell. Then: Edit menu > Copy. Or right click the cell, and then click copy from the popup menu. When done correctly, the border of the cell will have a blinking dashed line around it.
Then without going elsewhere first, select the column you want to change. Do this by clicking its column head. Then right click it, and click "Paste Special" from the menu that pops up. Only then will the full "Paste Special" menu show up. See the forum link higher up to see a picture of a version of that full "Paste special" menu. You can also click "Paste Special" via Edit menu > Paste Special > Paste Special.
In the "Operations" section click Multiply or Divide. Then click OK. The numbers in the column will be changed accordingly.
Conversion examples. Sandboxes for updating tables.
[edit]Return to top. See: w:Help:Table. It has a section on adding links and flags to country lists. See also the sections on tables and the Visual Editor (VE). That VE help covers much of what used to be here.
User sandboxes with info for updating tables with country lists. See the talk pages for updated info and later sandboxes.
From Help:Table: Sandboxes help a lot. For example; your user page: Special:MyPage. Create and bookmark some personal sandboxes too. Visual Editor will load very fast in empty sandboxes: Special:MyPage/Sandbox, Special:MyPage/Sandbox2, Special:MyPage/Sandbox3. As many as you want. Share the link when asking for help. To find all your sandboxes: Special:PrefixIndex/User: – click link, add user name to the spot labeled "Display pages with prefix:".
PDF to image files
[edit]See: Commons:PDF to image files
PDF tools
[edit]Some of the previous sections refer to PDF files. Wikipedia has a comprehensive list of PDF software. Much of it is free and open source. Browsers open PDF files nowadays.
Some sites that can convert a PDF table to Excel, CSV file, etc.. Upload PDF. Download converted file. Open it with freeware LibreOffice Calc. CSV files can be pasted directly into the visual editor in many cases. The unopened file. The table will show up.
CNET has a category: PDF Software Downloads for Windows. Much of it is free, or free to try. Click "free" link in the left sidebar for freeware. Initial sort is by downloads last week. Recent popularity is usually a good comparative guide to ease of use.
Appropedia has notes on porting PDF files to MediaWiki.
For tables and charts, converting PDF to SVG is usually the optimal choice if you have the skills and tools to do so. Two programs that can do this are:
Convert wiki tables to Excel
[edit]- See also: en:Help:Table
Maybe you need to work on some tables, and prefer to work in Excel:
- This Google search pulls up various methods to convert an HTML table to Excel.
Convert Excel to CSV
[edit]Convert xls, xlsx, etc. to CSV. CSV files create clean tables since CSV contains only values, headers, rows, and columns. No other formatting. So they are great for converting to clean wikitext tables.
Online tools
[edit]- Xls, xlsx, and many other file formats can be converted to other formats at zamzar.com. Upload the file, or paste in the URL of the file at zamzar.com/url, and the converted file will be emailed to you. It arrives fast (almost instantly) for small files. For an example see en:User:Timeshifter/Sandbox44.
Convert CSV, DSV, or Excel to HTML or wikitext
[edit]Convert Excel, comma-separated values (CSV), tab-separated values, delimiter-separated values (DSV), etc. to table wiki code.
- de:Wikipedia:Technik/Text/Basic/EXCEL-Tabellenumwandlung/en. The page is in English. Published in German Wikipedia project.
- A free opensource tool to convert Excel and CSV files to wiki table format: csv2other.
Online tools
[edit]- CSV Converter (csv2wp) - converts many types of spreadsheet tables, comma-separated values (CSV), tab-separated values, etc. to wiki code or HTML. You can use this to convert tables from Excel and more. More info in English: de:Benutzer:Duesentrieb/csv2wp_(en). For an example see en:User:Timeshifter/Sandbox44.
- Copy & Paste Excel-to-Wiki Converter. Also works with LibreOffice Calc.
Microsoft Word to wiki code
[edit]Microsoft Word converters. See:
Print screen, and then edit chart image
[edit]The charts can be converted to images by using the "Print Screen" key on a keyboard. Image editors can then be used to capture and crop the chart found on the screenshot.
There are many free image editors. See:
For example; there is the free, popular, easy-to-use Irfanview. Use it to resize charts, remove watermarks, crop unused space from around the edges, and so on. Irfanview can also losslessly compress PNG images so as to use less kilobytes for the same image without any loss in image quality. Install the Irfanview plugin pack too. It installs instantly and includes even better PNG compression, PNGOUT, which is easy to use in Irfanview.
Add text to chart images
[edit]Freeware IrfanView, (and many other image editors), is useful for adding text to charts and other images. Open a chart in IrfanView. Crop the chart as needed. The smaller the margins, the better for the chart showing up more clearly in Wikipedia articles at smaller sizes. Click on the chart where you want text to begin, and drag a large rectangle box where the text will be inserted. Make it large since text will not extend outside the box. The box lines do not remain after you finish editing the image. After you have drawn a box go to the edit menu, and click on "insert text". Choose left, center, or right alignment. Pick your font, font size, and color from the dialog box. Then click "preview" in the dialog box. The text will be inserted temporarily in the large box. The background will not be effected if the background is set to "transparent" in the dialog box. Change your settings until you get what you want in the preview. Then click "OK" in the dialog box. Save the image when you are done.
Editing resulting image files
[edit]There are many tools, and help pages. See:
- en: image editing
- en: Wikipedia: Graphics Lab
- Commons: Help desk - also has table of Commons discussion pages.
- Help: Contents - This page is an index of all Wikimedia ' maintenance and pages.
Removing part of an image, and splicing the parts
[edit]This is useful for many charts and maps. See this version of this map. It was created by removing a section of the map image found at the source.
A freeware image editor can be used such as IrfanView. In this case it was used to remove part of the screenshot image, splice the remaining parts, and add a border:
- Edit menu > remove strip.
- Image menu > add border.
Spreadsheets to automatically convert Excel data to SVG code
[edit]See User:RCraig09/Excel to XML for SVG for a description of how users can use my Microsoft Excel spreadsheets to automatically generate efficient SVG code for charts.
My spreadsheets are completely text-based (manually choosing options for margins, axis data ranges, etc.), and are not as polished as graphics-based commercial products. RCraig09 (talk) 18:25, 14 February 2024 (UTC)