Generating New File in Every Iteration in LabVIEW

Updated Jun 23, 2025

Reported In

Software

  • LabVIEW

Issue Details

  • How can I generate a new file for each iteration of the loop?
  • What's the best way to ensure each file has a unique name that doesn't conflict with existing files?

Solution

Figure 1 - Each loop iteration generates new excel

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

Format Into String

This approach is designed to add sequential numbering to the filename. In the displayed example, 'BlankFile_%03d.xlsx', the '%03d' portion serves as a placeholder that increments with each loop iteration. This means that every time the loop executes, it creates a new file with a distinct name, ensuring no existing files are overwritten.

Write Delimited Spreadsheets.vi

This VI receives the formatted filename along with your 2D data array, then creates a new Excel file using that specific name and writes your waveform or measurement data to the file.

Summary

Each loop iteration produces a separate Excel file with sequential numbering, preventing overwrites and organizing your data chronologically. This is ideal for logging time-series data, multiple measurements, or any scenario where you need to preserve data from each iteration separately.