LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

display .dat file as spreadsheet

I have a VI that creates a .dat file from several channels of a couple of DAQs. I would like to be able to open the files in some sort of spreadsheet format to see the raw data. Excel would be nice since that is what I am most familiar with, but if I can do it easily in LV, I'm fine with that as well. The files are, i think, too large to post here (4.7MB each), but I can do that if necessary. I'm not sure if the files are CSV or tab delineated. I couldn't find any examples of VIs that will accomplish this. Any help would be appreciated. 
0 Kudos
Message 1 of 17
(7,267 Views)

The best way to  go forward would be to post the VI so that we can tell you exactly how the data is being written to the file. It might be 'binary data' (32 or 64 bit or else) so excel would just show garbage.

 

However, you can try to open it with excel as follows:

 

Rt click the file, select 'open with', then 'choose program'. then select 'MS excel'.

The file should open in excel and you can then see if the values make sense.

 

A better way of opening the file is excel is to open Excel, then select 'open...' and change the 'types of files' to 'All files (*.*)'. this way, you can see the '*.dat' file also. Once you open it, excel will display a wizard which will let you specifiy if it is a tab delimmited, comma separated or else. You can then experiment to see which gives you the correct data in each column.

 

Hope this helps.

 

Cheers!!!

Message Edited by Mani's World on 12-30-2008 04:55 PM
0 Kudos
Message 2 of 17
(7,256 Views)
try this.  it will open in excel... has a formatting question: press yes and enjoy
0 Kudos
Message 3 of 17
(7,217 Views)

Zinnium wrote:
try this.  it will open in excel... has a formatting question: press yes and enjoy

 

 

Or, you could simply use the Write to Spreadsheet File function. That will create a text file, but it will be formatted so you can open it in Excel, or other spreadsheet program.

0 Kudos
Message 4 of 17
(7,195 Views)
Yeah,  but I work in industry and not in the lab.  My clients want an excel sheet, and not a text file.   Its easier to give them what they want and not argue with them.
0 Kudos
Message 5 of 17
(7,184 Views)

Zinnium a écrit:
Yeah,  but I work in industry and not in the lab.  My clients want an excel sheet, and not a text file.   Its easier to give them what they want and not argue with them.

If you use the .xls extension instead of a .txt extension when naming the file, the file will still be a text file, but will be considered as an Excel file (and opened directly with Excel 😛 ). This is the easiest method, something you did in your ExcelForFree VI, but that applies also to the files saved directly with the Write to spreadsheet VI ! 
Message Edité par chilly charly le 01-04-2009 10:36 PM
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 17
(7,178 Views)

This is actually different.    By using this concept you can create a real excel spread sheet with macros and everything. You can still open it up and read from it, edit it, and write to it again.  You can add sheets, set fonts, set colors, adjust column and row sizes and even have more control over it than the actual NI MS Offices toolkit has.  

 

That is the power of this method, and its not a text file.

 

Shane

0 Kudos
Message 7 of 17
(7,169 Views)

Zinnium a écrit:

This is actually different.    By using this concept you can create a real excel spread sheet with macros and everything. You can still open it up and read from it, edit it, and write to it again.  You can add sheets, set fonts, set colors, adjust column and row sizes and even have more control over it than the actual NI MS Offices toolkit has.  

That is the power of this method, and its not a text file.


I'm probably missing something here. The method you propose creates the HTML table file below (opened with the Read from Text File VI (does this implies that it is a text file ? ;)). We are far from an Excel (native) file ! 😉
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<!-- Constructed with LabVIEW Report Generation -->
<HEAD>
<TITLE></TITLE>
</HEAD><BODY>
<TABLE BORDER="1">
<TR>
<TD WIDTH="100">a</TD>
<TD WIDTH="100"></TD><TD WIDTH="100"></TD>
<TD WIDTH="100"></TD>
[.........]
<TD WIDTH="100"></TD>
<TD WIDTH="100"></TD>
<TD WIDTH="100"></TD>
<TD WIDTH="100"></TD>
</TR>
</TABLE>
</BODY>
</HTML>

As a matter of fact, Excel can open and interpret html files. Fine. Once imported into Excel, you can do whatever you want with the file content. Not really surprizing. Of course, the same considerations applie to the tab-formated text files generated using the Write to Spreadsheet VI. They have the same "reality" as html files disguised with a .xls extension.
Of course if you plan to include a complete set of html commands into the file, your method is perfect. But, apart using the NI report generation toolkit (a solution that is apparently not the one you recommand), I personnaly would not go that way ! Have you developed your own html toolkit ? Could you explain what I'm missing here ?
(BTW, do you know a way to open an Excel sheet with the NI report generation tools ?)  

 

Chilly Charly    (aka CC)
0 Kudos
Message 8 of 17
(7,159 Views)

Zinnium wrote:
Yeah,  but I work in industry and not in the lab. 

So do I. I still use the Write To Spreadsheet File and use the .xls extension, as CC mentioned. Works perfectly fine.

0 Kudos
Message 9 of 17
(7,136 Views)


chilly charly wrote:

Zinnium a écrit:
Yeah,  but I work in industry and not in the lab.  My clients want an excel sheet, and not a text file.   Its easier to give them what they want and not argue with them.

If you use the .xls extension instead of a .txt extension when naming the file, the file will still be a text file, but will be considered as an Excel file (and opened directly with Excel 😛 ). This is the easiest method, something you did in your ExcelForFree VI, but that applies also to the files saved directly with the Write to spreadsheet VI ! 
Message Edité par chilly charly le 01-04-2009 10:36 PM

One thing I have noticed however is that saving with a .xls file extension will not let you open the excel file while data is being written, but with a .txt extension you can. I had this issue when notes needed to be added to the data file while the program was still running (example, liquid nitrogen was added to the system and this had to be marked in the data file). I saved as a .txt extension and after the program was done its just a simple right click on the file, open with excel, or a change of the .txt to .xls. Hardly time consuming... 

0 Kudos
Message 10 of 17
(7,122 Views)