Write an Array of Mixed Data Types to a Spreadsheet in LabVIEW

Updated Oct 26, 2023



  • LabVIEW

This article goes through the steps for writing an array of mixed data types such as numeric values and strings into the same spreadsheet using the Write Delimited Spreadsheet VI in LabVIEW.

In order to write an array of mixed data types using LabVIEW, you can use either several Write Delimited Spreadsheet VIs or place all of the values on a single array and use a single Write Delimited Spreadsheet VI. LabVIEW arrays cannot have mixed data types so the workaround is to convert the values to strings to have an array of strings.

In both examples, numeric values and strings are written into the spreadsheet.

Option 1: Use Multiple Write Delimited Spreadsheet VIs

1. Place a Write Delimited Spreadsheet VI in the block diagram and wire the necessary inputs according to your needs.
2. Place a second Write Delimited Spreadsheet VI and use the same file path as the previous function by wiring it directly from the previous Write Delimited Spreadsheet VI.
3. Wire a true value to the append to file? terminal. This is going to append the new array to the file instead of overwriting or creating a new file.
4. You can follow this process to continue appending arrays to the same spreadsheet file if you need to write more arrays of other data types.

The resulting VI should look similar to the one below:
Option 1

Option 2: Use a Single Array for the Values

1. Place an Array To Spreadsheet String Function and wire the first array to the array terminal and wire the format string input according to your data type which specifies how to convert the input array into a string.
2. Follow the same process for the second array which has a different data type.
3. Use the Concatenate Strings Function to concatenate the resulting strings of the arrays.
4. Use the Spreadsheet String To Array Function to create an array of strings which you can use to write the spreadsheet by wiring it directly to the 2D data input from the Write Delimited Spreadsheet VI.
5. Wire an array of strings to the array type input from the Write Delimited Spreadsheet VI.

The resulting VI should look similar to the one below:
Option 2