Extract Column Data from Spreadsheet Line by Line

Updated Nov 29, 2018

Reported In


  • LabVIEW

Issue Details

I want to extract specific column data from a spreadsheet file. I can open the whole file and extract certain column data when I have a small file. However, the file is so big that I can't open the whole file and read one column data. How can I do?


One method is to read file line by line and collect specific column data until the end of the file. You can implement this method by using Read Delimited Spreadsheet.vi with while loop.
Please refer to the instruction and code image below : 
  1. Set number of rows as 1, so that Read Delimited Spreadsheet.vi reads one line per iteration of while loop.
  2. Using shift register initialized 0, input shift register value at start of the iteration.
  3. Wire output of mark after read into the other side of the shift register.
  4. Extract specific column data from each line using Index Array. Wire data line to the edge of the loop and make an output tunnel.
  5. At the loop tunnel, right click and select Tunnel mode»Indexing. Now Tunnel is auto-indexing data.
  6. When start of read offset reached at the end of lines in the file, EOF? returns a true value and a user can stop while loop.

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.
As a result, you can see a column data extracted from original data.

Extracted column data compared to original data.

Additional Information


When you enable auto-indexing for output terminal, just like instruction above, the output array receives a new element from every iteration of the loop. Otherwise, if you disable auto-indexing for the output tunnel, you receive the value of data from the last iteration.
For further information, please refer to the link below.