06-25-2009 09:34 PM
I am using a slightly modified version of the "Table to XL.vi" to assist with importing data from a text into Excel. I have run into a problem when using this.
The data is being read from the text file and imported fine, except for one problem. There are 2 columns I have that have time and date data. After importing, this data is just displayed as normal numbers. I have tried right clicking in Excel to change the format of the cells, but this does not help.
Does anyone know what might be going on? Any suggestions as to how to fix this?
Thanks in advance.
06-26-2009 01:39 PM
What values are in these 2 columns in the text file? Are you doing any kind of parsing in LabVIEW? Keep in mind that Excel and LabVIEW have different starting dates (there have been numerous posts on this over the years). Can you provide your data and your code?
06-26-2009 01:53 PM - edited 06-26-2009 01:53 PM
06-29-2009 08:37 AM
06-29-2009 02:07 PM
Your code leaves a lot to be desired. I'll get to that in a minute... Your fundamental problem is that you are reading the file as floating point. This means that LabVIEW tries to convert "1:48:25 PM" to a floating point number. All you get is 1 because that's all you can get. There is no "automatic detection that it's a date" mechanism. You have to read the file as a 2D array of strings. You are using LabVIEW 7, which means you have to create a modified version of the Write to Spreadsheet File VI to read in the data as strings. Open the Write to Spreadsheet File VI. It contains comments on how to do this.
As for the code...
06-29-2009 02:38 PM
Thanks for reply once again. The code is very rough, and parts of it have been quickly copied from another program I have. This was far from polished or finished product. I did not even know if this would even work. I thought about this idea (opening files via LV into Excel) not that long ago, and was just trying to look into how it was done. This is more than just importing 1 file, sometimes many text files. I just included 1 here as an example. I thought it would be easier and quicker to do this via Labview than to import by "hand" many, many text files. Like I said, this was merely an idea I had. I have no headers at the moment in the program, I just have not inputed the correct ones that I eventually want to use, hence why I just left the default ones there.
I will look into your suggestions and work on them to imporve the program. I know it needs much work, this was just a thought I had on a whim. I know I am not the most "polished" programmer in the the world and still have much to learn about Labview.
Again, thanks for your comments. The help here is always appreciated.