From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XLSX file merging columns, Help please!!

I have 2 xlsx files  with data from 2 sensors i want to create a program that can merge these 2 files in one file based on the tiem stamps.

So i want the columns of each file next to each other in a new file,

I am trying for a week but are stuck. 

 

Data 1 is from a power sensor with:

 column 1: timestamp
column2: runtime
column 3: average power
column 4: peak power

 

data 2 is from a gos sensor with: 

data gps sensor with:
column 1: timestamp
column2: latitude
column 3: longitude
column 4: altitude

 

I am also attaching the files, I hope to find some help, please

 

Download All
0 Kudos
Message 1 of 11
(3,209 Views)

I have 2 xlsx files  with data from 2 sensors i want to create a program that can merge these 2 files in one file based on the tiem stamps.

So i want the columns of each file next to each other in a new file,

I am trying for a week but are stuck. 

 

Data 1 is from a power sensor with:

 column 1: timestamp
column2: runtime
column 3: average power
column 4: peak power

 

data 2 is from a gps sensor with: 

data gps sensor with:
column 1: timestamp
column2: latitude
column 3: longitude
column 4: altitude

 

I am also attaching the files, I hope to find some help, please

 

0 Kudos
Message 2 of 11
(3,200 Views)

I have 2 xlsx files  with data from 2 sensors i want to create a program that can merge these 2 files in one file based on the tiem stamps.

So i want the columns of each file next to each other in a new file,

I am trying for a week but are stuck. 

 

Data 1 is from a power sensor with:

 column 1: timestamp
column2: runtime
column 3: average power
column 4: peak power

 

data 2 is from a gps sensor with: 

data gps sensor with:
column 1: timestamp
column2: latitude
column 3: longitude
column 4: altitude

 

I am also attaching the files, I hope to find some help, please

 

0 Kudos
Message 3 of 11
(3,217 Views)

Can you show us where exactly you are stuck (meaning: upload a VI).

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 4 of 11
(3,182 Views)

Hi shivik,

 

do as you suggested on your own in this image: read both files, sort the data by timestamp, then store the combined data in a new file.

 

Is this related to your other thread? Why not store all the data in one file just at acquisition time?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(3,163 Views)

Please learn how to post with attachments -- you do not need to post the same message three times, with first one set of three attachments, then two sets, then three sets.  What part of this do you not know how to do?  Where is the code (meaning a VI, not a picture) showing what you have tried?  How about showing the code that generates these two files -- maybe you would be better off writing a single file when generating the data ...

 

Are you just learning LabVIEW?  Have you spent time with the appropriate LabVIEW Tutorial material?  Do you have colleagues/teachers/co-workers with whom to discuss your project and share ideas?

 

0 Kudos
Message 6 of 11
(3,159 Views)

Hello sorry for that my internet is very slow, i will upload the vi today. Uploadig erros make hat it's being posted 2/3 times. No i have no one else to help me

0 Kudos
Message 7 of 11
(3,141 Views)

Thanks for providing some code.  I can at least give you the Bad News first ...

 

Your title mentions an Excel .xlsx file, and your earlier attachments were, indeed, Excel .xlsx files.  These are not files that can be read or written using LabVIEW's Read/Write Delimited Spreadsheet File -- those files are pure Text files, written with columns separated by a "separator character" (by default, <Tab>, but often <comma>) and rows written as lines of "delimited columns".  Note that if the delimiter is a comma, this file format can be called a "Comma-separated Values" (or .csv) file, and Excel can also open files with the .csv extension (indeed, Windows, by default, assigns an "Excel-looking" Icon to .csv files, creating confusion for LabVIEW users).

 

However, depending on the Version of LabVIEW that you have, you might have the Report Generation Toolkit, which includes routines that can Read and Write true Excel (both .xls and .xlsx) files.  So, in principle, your request can be programmed using LabVIEW.

 

Here are some things to consider:

  • Your description suggests that you want a file with one column having time, and two sets of columns containing the "other" data from the other two files.  Have you thought about how you are going to align the data if the Time entries do not match?  [I did a quick glance at your data files, and it appeared that the Time columns, in fact, did not match!].
  • I assume that the Time column is using Excel's Date/Time representation.  Unfortunately, this is slightly different from LabVIEW's TimeStamp implementation (for one thing, Time Zero differs by about 4 years; also Date/Time is expressed as Days by Excel and Seconds by LabVIEW).

There are a number of examples in the Forums and on the Web showing how to use the Report Generation Toolkit (or RGT) to read and write Excel.  If you have the Toolkit available, and can at least "have a plan" for handling the points raised above, then it should be possible to do what you describe.

 

A good place to start to learn a bit about the RGT and Excel is to search this Forum by opening the Search tool and typing the characters "Revised " (that is, Revised followed by a space).  After a second, this should pop up a number of suggestions, with the first one being Very Relevant -- I also know the author.  Study the example, see if you can adopt any of it to your question, and try your hand at writing an Excel File with LabVIEW.  If you get stuck with reading Excel, generate a new Post and we'll provide more help.

 

Bob Schor

Message 8 of 11
(3,123 Views)

Thanks for that part of help. I have now data in an lvm file. I would like to add the channel names to the columns, can you give me an idea how to do that. I have cheeked several posts but those were not useful for my case,

 

I am showing what i exactly are trying to do in the attached pictures and the way i am storing the data

Download All
0 Kudos
Message 9 of 11
(3,081 Views)

If you want to show us LabVIEW Code, attach the VI, not a picture of it.  With the VI, we can closely inspect the code, see "behind" Case structures, open up the Dreaded DAQ Assistant and check its configuration, see what version of LabVIEW you are using, test the code, "improve" the code, etc.

 

Bob Schor

0 Kudos
Message 10 of 11
(3,069 Views)