Adding Tables
Why Tables?
A table can be a useful tool for displaying large amounts of data in an easy-to-understand format. Take care that tables you include on your pages don't get too long or complex, as they can make webpages overwhelming, confusing, or difficult to read. For very large or complex tables, consider attaching a link to a spreadsheet file instead. See Adding PDFs and Other Files for information on uploading and linking to files.
Tables can be built by two methods:
- from scratch, by setting the number of rows and columns and filling in each cell in Drupal.
- Uploading a .CSV spreadsheet file.
Building a Table from Scratch
Using the Widget
For a basic table, using the Table widget is the simplest method. The widget allows you to set your number of rows and columns, creates a header row, and styles the table for you.
- Open the editor for the piece of content you'd like to add your Table to. (See Accessing the Page Editor if you're not sure how)
- In the Sections area of the editor, either add a new section or click Edit on an existing section.
- Under Content, click the arrow of the drop-down menu. By default, the drop-down displays Add Text. Choose Add Table from the drop-down menu.
- By default, Tables are set to dimensions of 5 rows x 5 columns. To change the number of rows and columns, scroll to Change Number of Rows/Columns, click the header, and enter the desired number of rows and columns in the correct fields. Click Rebuild Table to rebuild the table with the specified number of rows and columns.
- Note- If you do not want your table to have a header row in the top row, add one extra row to your table and leave the first row blank when entering data.
- You may also use the Change Number of Rows/Columns option after you have begun entering data into the table. Data will be retained as long as you do not reduce the number of columns and rows past those you have already entered data into.
- In the Table Caption field, enter a sentence describing the content of your table.
- Enter your table content into the table, cell by cell. The first row in the table will format as a header unless left blank.
- Click Add Row if you need to add additional rows.
Using the Text Editor
Creating a table with the Text Editor allows you more customization options than the Table widget. It also allows you to directly edit the table's HTML code. Use this option if you cannot create the table you need in the widget.
- Open the editor for the piece of content you'd like to add your Table to. (See Accessing the Page Editor if you're not sure how)
- In the Sections area of the editor, either add a new section or click Edit on an existing section.
- Under Content, click Add Text.
- Click the Table button on the Text Editor toolbar.
- Enter the number of rows and columns you'd like in your table in the Rows and Columns field.
- You may set a custom height for your table in the height field. Enter the number of pixels in height you would like your table to stretch.
- Choose a Headers style from the Headers drop-down. You may select no Headers (None), a Header Row, a Header Column, or both a Row and a Column.
- Cell Spacing and Cell Padding determine the amount of white space added outside and inside the cells, respectively. These can usually be left at 1.
- Border Size defines the width of the border separating the cells.
- Alignment defines the alignment of text within a cell — you may select Left, Right, or Centered.
- The Caption field creates a caption for the table that will sit on top. This is useful for titling the table.
- In the Summary field, enter a short sentence describing the table and its information.
- Click OK.
Uploading a .CSV Spreadsheet File
- Open the editor for the piece of content you'd like to add your Table to. (See Accessing the Page Editor if you're not sure how)
- In the Sections area of the editor, either add a new section or click Edit on an existing section.
- Under Content, click the arrow of the drop-down menu. By default, the drop-down displays Add Text. Choose Add Table from the drop-down menu.
- Scroll to Import from CSV and click the header. Under File Upload, click Choose File.
- Use the file browser that opens to select a .CSV file from your computer and click Open.
- Click Upload CSV.
- The Table widget will automatically populate with the content of your CSV file. You may now make any edits or changes to the table you wish.