LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Multiple CSV Files and Export to Excel with Separate Worksheets

Hi everyone,

I'm working on a LabVIEW project and need help with the following task :

I have a folder that contains multiple CSV files (e.g., test1.csv, test2.csv, ..., test10.csv). What I want to do is:

  1. Ask the user to select a directory that contains the CSV files.

  2. Loop through each CSV file in that folder.

  3. Read the contents of each CSV.

  4. Create a single Excel file (AllCSVs.xlsx) that contains:

    • One worksheet per CSV file.

    • Each worksheet should be named according to the filename (e.g., test1, test2, etc.).

    • The content of each worksheet should be the data from the corresponding CSV file.

If anyone has done this before or has an example VI, code snippet, or tips, that would be amazing!

Thanks a lot in advance! 🙏

0 Kudos
Message 1 of 3
(108 Views)

for item 1 use the function File Dialog configured to select path and existing files. 

LVNinja_0-1744045216846.png

2. Use function List folter, it will return an array with all the files from the folder you selected. 

 

LVNinja_4-1744045438901.png

3. FOr this you will need to use the Active X functions for Excell. 

You read each file and add a sheet on Excell worksheet. 

Check the example WRITE EXCEL Table, that will give you a starting point to add data into excell. then expand it ot repeat for each csv file. 

 

 

 

 

 

 

 

0 Kudos
Message 2 of 3
(93 Views)

Amazing thank you for your answer! 

0 Kudos
Message 3 of 3
(72 Views)