Importing Data with the CSV Widget

Megalytic provides a CSV widget to handle situations where you want to import data and display it in a report. You can upload CSV data directly in to Megalytic, or host the CSV files on your server, Dropbox, Google Sheets, etc. Data must be uploaded in CSV format (the delimiter must be the comma character ‘,’).

In addition, the first line of the CSV file must contain the column headers.


To see a sample of the required CSV format with headers, click here.


Optionally, you can omit the column headers, but you must indicate that your file has no headers in the dialog box that appears when you upload your file.


To see a sample of the required CSV format without headers, click here.


The CSV widget treats data in all cells as being in string format. If data in any cell contains a comma, it must be enclosed in quotes.


Here is what the widget looks like, with and without column headers.

csv-widget-appearance


Sometimes, when you import data from a CSV file, you will want to adjust the formatting in the CSV widget table. For example, if you have a column, like “Widgets Sold” that has some numbers with commas “,” and some without, you may see an alignment issue like the one below.

csv-column-alignment-example


The happens because the CSV widget interprets the numbers with commas (“,”) as strings which get left justified by default, and the numbers without commas as numbers which get right justified by default.
You can fix this issue by clicking on the column in the widget editor to open up the formatting tool. By default the alignment is “Auto”, but if you switch it to “Right”, the numbers will be right-justified.

csv-column-right-justify


As you can see, the options for Text Alignment are “Auto”, “Right”, “Left”, “Center”, and “Justify”. “Auto” aligns text to the left and numbers to the right. “Justify” is like a newspaper column where the spaces between words are adjusted so all the words start and end on the same vertical lines. You need to have at least a paragraph of text to see the effect of “Justify” visually.


Format can be set to “None”, “Number”, “Percent”, “Currency”, or “Change Indicator”. You can also specify the number of Decimal Places and a currency symbol.