Writing data to an XLS file without Excel. Tutorial.
My goal is to transfer this data to excel, such that each time the user hits “print” on the scale indicator a new row is appended to an existing Excel file that contains the data.
It is assumed that:
You've prepared parser items for export. For this tutorial all items were prepared in the previous part.
We've selected the "Excel Export Pro" plugin because main advantages are:
Also you may read other examples:
All parser items are now ready for export using "Excel Export Pro" plug-in. Please, open the configuration window of the "Excel Export Pro" plug-in (fig.1) by selecting the module in a list and clicking the "Setup" button on the "Data export" page.
Fig.1. Excel file settings.
Just select options in the field #1 and the field #2. These options will allow you to create a new XLS file every day in the "C:\Logs" directory with the "data" name. The name will be contain the date too.
Note: We recoomend to split Excel files by date or time because large files will slow down the logger. The optimal file size is up to 1000 rows. Also if your data goes fast (several Excel rows per second) then you may optimize program performance by saving data to the file after some interval.
The next page "Data format" (fig.2) is used to specify export format for parser items with different data type. On this page we need the format for date and time.
Fig.2. Format settings.
The next page "Export" (fig.3) is very important. On this page you may all parser item which you want to write to Excel file. If the list on this page is empty then the plugin will ask you to add all existing parser items. The "Action" button allows to add, remove or move parser items in the list.
Fig.3. Parser items.
By clicking the item name in the tree (fig. 4, pos #1) you may define configure the export settings for each parser item. First of all define the start cell for the selected parser item (fig.4, pos. #2).
Fig.4. Parser item. Start cell.
Second, specify the header for the parser item (fig. 5, pos. 1). If you want you may define a custom font for the header (fig. 5, pos. 2).
Fig.5. Parser item. Header.
Other setting page (Value and Formatting) are not used in this tutorial and fully described in the help file.
Repeat two steps above for each parser item.
Click the "OK" button and close the "Excel Export Pro" plug-in configuration window and the "OK" button in the options window.
Okay, all settings have been completed and we are ready to capture data to an Excel file.
If the data export module and the parser had been correctly set up, then you should see a new Excel file in the destination directory when you'll receive a new portion of data.