LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i combine multi csv file into excel

Solved!
Go to solution

hi all,

i'm learning labview recently 2week :(( 

This problem stuck with me for a long.

 

i have a lot of csv files, and i want to combine these data into an excel .

how can i improve or some samples could give me reference.

 

regard.

Download All
0 Kudos
Message 1 of 4
(920 Views)
  • How are you learning LabVIEW?  Have you tried the Resources listed on the first page of this Forum?
  • Do you understand the idea behind a .csv (comma-separated values) file?  In the two data files you posted, do you intend the first row to have as three columns "# Channel 1", "<blank>", "<blank>" and the second row "# Traces 2", "<blank>", "blank">"?  Did you notice that the two trailing commas aren't "separating any values", and all of the text in those lines will wind up in the first cell if read by Excel (or by LabVIEW's Read Delimited Spreadsheet function)?
  • What do you mean by "an Excel"?  What are you really trying to do?  Don't you think you should master some of the basics of LabVIEW before trying to do fancy things with reading files and transferring data to another system (Excel) developed/supported by another vendor (Microsoft)?
  • Suppose I gave you two text files (let's call them "1.csv" and "2.csv".  Based on your knowledge of LabVIEW and of any other programming language (Basic, C, Matlab, etc.), how would you combine these two files into one called "1+2.csv"?  Maybe that would give you some ideas and thoughts about what you are trying to do.  [It also gets to the question of what it means to "combine data" in Excel -- does it mean "put more data on a single WorkSheet", or does it mean "put data on multiple WorkSheets"?]

Bob Schor

Message 2 of 4
(884 Views)

I cannot read your diagram comments (unicode?), but all you probably need to do is use an array of paths and a FOR loop to read them all. Of course you also need to decide how to combine them (e.g. append rows or columns, etc.), before writing the excel file.

 

Is your current example working correctly? You can use "list folder" with a pattern of *.csv to create an array of all file names, then follow the suggestion above.

 

To keep code organized, never name a vi "untitled x.vi". Always give a unique name that describes the function.

0 Kudos
Message 3 of 4
(840 Views)
Solution
Accepted by topic author televisionbo6

Asking specific questions in a technical forum and getting a simple example back is an excellent way to learn LabVIEW. Feel free to ask again whenever you get stuck!

 

Here's a very simple draft of how it could be done. Study it well, then expand* to suit your needs.

 

altenbach_0-1692544973351.png

 

 

*examples

  • Decide what do do with the headers, e.g. write them once.
  • use a more complex pattern to only select a subset of files (e.g. "abc*.csv")
  • Leave out the third column because it is not interesting,
  • etc.

 

Message 4 of 4
(827 Views)