Page Icon How To Save and Apply a Layout in a CSV Files - Rons Data Edit

Introduction

The beauty of the CSV file format, and possibly the secret to its success, is its simplicity. CSV files are text files with the bare minimum information added to be able to separate rows and columns (see What Is a CSV File?).

Unfortunately, the CSV format has next to zero ways of adding extra information about the data they contain. An example of 'extra information' might be to indicate that a certain column contains dates, or that the text encoding is UTF-8. Over the years, modifications have been suggested to the CSV format, but none have really survived, probably because they conflict with the very essence of the format: simplicity.

In conclusion, adding 'extra information' to a CSV file for the purposes of data enrichment is off limits. Any such enhancements need to be done in a different way.

What are Layout Templates

When a table of data is presented in Rons Data Edit, the table that you actually see is a View layer on top of the actual table. This View layer can be used to filter rows, hide and move columns and hold column width. You can see them in action when you use Quick Filter, or view Duplicate Rows.

Window Filtered Sorted

Further, whilst being designed from the ground up to treat CSV files as text, Rons Data Edit tackles the limits of the CSV file format data types in a few interesting ways. For example, when filtering or sorting, Rons Data Edit processes text values into dates or numbers so that they are treated correctly.

Layout Templates are essentially lists of instructions that allow the way a CSV file is viewed to be changed by applying those instructions to the View layer.

Layout Templates Abilities

Layout Templates work by running through a list of rules, one by one, and applying the settings associated with that rule to any column name that matches. Column names can be matched in a number of ways including wild cards and regular expressions.

A Layout Template can be applied to any view of a table of data, and any rules that match the table columns with be applied.

Window Current Template

Layout templates can be created from the current document, created from scratch, loaded and saved, copied and pasted, and applied to all views or just the current view.

One particular use case for layout templates is to ensure all the views of a document are laid out identically for visual comparison.

How to create a new template

Layout Templates can be created in the following ways.

An Empty Template

Using the command 'Layout\Layout Template\Create New' opens a clean empty Template for editing.

Create New Template

Rules can now be added using the Add or Insert buttons and the Template can be Applied or Saved for later use.

Note: Care should be taken with the 'Position' setting. As the rules are applied top to bottom, sometimes the results appear unpredictable because they are executed on columns that are positioned according to the previously executed rules. For example, all rules that move columns to the End (right) of the document should probably be at the bottom of the rule list.

From the Current Document

Using the command 'Layout\Layout Template\Open Current' opens a Template populated from the columns of the current document for editing.

Window Current Template

Again, rules can now be added using the Add or Insert buttons, or deleted, and the Template can be Applied or Saved for later use.

Using Templates

A template can be applied to the current view, all the views in a document, or all the views in all the open documents, in a number of ways.

Window Template Applied

The picture above shows a document with a Template applied. Note the 'View Layout' panel shows exactly how the columns are laid out, and their relationship to the underlying data table.

From the Edit Template Window

The Edit Template window contains an Apply button than allows that open Template to be applied as indicated above.

From the Clipboard

Templates don't always need to be saved for later; sometimes you just want to make sure two or more layouts are in alignment.

For this reason a Template can be copied to the clipboard, then pasted between views or documents to apply the Template. They can even be edited from the clipboard.

All these options are available under the 'Layout\Layout Template' menu.

Using templates to set column layout

If, after editing your 'View Layout' to be exactly as you want it, you want to permanently apply the layout to the underlying table data, use the command 'Columns/Update Schema'.

Window Update Schema

This will actually alter the CSV document, and can be immediately undone, but after saving the document the resulting CSV file will have the structure of the 'View Layout'.

Downloads

article_csv_data.csv
article_template.viewlay


Tags: Rons Data Edit
Our Products
Rons Data Edit Icon

Rons Data Edit - Professional CSV Editor

Learn more

Rons Data Stream Icon

Rons Data Stream - Batch CSV Processor

Learn more

Rons WebLynx Icon

Rons WebLynx - Desktop Bookmark Manager

Learn more

Rons CSV Editor Icon

Rons CSV Editor - now Rons Data Edit

Learn more

Rons Renamer Icon

Rons Renamer - Powerful Batch File Renamer

Learn more