Use spreadsheets to create tables and forms on your blog

A few days ago I did an article in which we explained how to create tables in your blog with an online utility and you know that there is also some plugin that can help you. Well, there is also a mode, if you want more advanced, but that uses the software installed on your computer – most of the time – a spreadsheet such as Excel, Numbers or the one included in the OpenOffice.org suite .

For this the trick is to use the function concatenate () and export the created table to valid XHTML manually. Let's see an example.

The Concatenate Function ()

The function concatenate () allows you to easily combine Excel data with XHTML marks when joining text and data contained in the cells of the spreadsheet.

The syntax of the function is simple: = concatenate (A1, "text", A2)

Basically, what you are saying is that take the value that is in cell A1 combine it with the text string, and then combine these two with the value of cell A2. In this way, if the number 3 is in cell A1 and the word "testing" in cell A2, the function will show you as a result: 3probando .

I think it's pretty understandable, but you I put a screenshot of the starting spreadsheet …

As you can see, there are 7 columns and a series of rows. What we will do is use the function concatenate () twice to create our table, one for the header and one for all the rows.

The Header Row

The function concatenate () for the header row will be only in one cell. If you look at the previous image you will see that the header data are in row 2, and go from column B to G ..

What we are going to do is insert our custom function in cell I2 (column I, row 2). What we actually do is take the data from this header row and combine it with the HTML tags

and

. To "trick" the system we will tell the spreadsheet that these labels with text enclose them in quotation marks ("")

The specific concatenation () function used in this row will be this:

If you look at detail we are creating the structure that, when exporting, will convert what we now declare as text into HTML code that our WordPress editor will understand and show as a table. The resulting text, understandable by the blog as a code, is this:

The Body of the Table

The next function concatenate () will be that of the other rows, and will combine the data of each row with labels

and

.

This function will be introduced first in cell I3. Once we have it, only will have to copy it down to the rest of the rows in column . The values ​​of the cell in the function are relative, so the function copied to the rest of the rows will be adapted to reference the cells of its same column. Your spreadsheet will do it on its own.

The function concatenate () specific to the rows of the body of the table is the one you have below:

Once you have copied the formula in the following rows you will have something like this …

Well, you already have the base of what you need to make your table in HTML.

Moving on to XHTML

The following is a little trick for which we use the possibility of copying and pasting special sheet s calculation . You just have to copy the cells, and paste them as I explain:

Copy cell I2, which is where we had the values ​​for the header.

Make a paste special, or paste values ​​ – depends of the spreadsheet you use-, in another cell of that same column. In the following rows of the column you are doing the same with each row. What you do is get a column with values ​​as text, without any reference to functions of the spreadsheet.

Once you have all the values ​​you just have to copy them into your HTML editor and you will get what you were looking for, all the codes and values ​​of your table (only without the label

of opening and closing).

Here you have the result:

JANUARY FEBRUARY MARCH APRIL MAY JUNE
UNO 1500 1800 1800 2600 2300 2500
DOS 2000 1600 1700 1900 2300 2400
THREE 3000 2500 2300 2800 ] 3100 3000
FOUR 1400 1100 900 1100 1400 1500

Although it seems somewhat tedious I assure you that it is much less than it is Write hundreds of "tr" and "td" in code. In this example we have few rows but imagine a table with dozens of them.

Thank you

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you: