LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to Spreadsheet

Solved!
Go to solution

@laps682 wrote:

Also, I tried implementing the headers that was suggested and you can see the result below... not sure why the tabs are also not applied in the same way as the numbers but I am assuming it is due to one of the arrays being numeric and the other a string but I am not sure, can somebody advise? 

 

For the file name, I realized that I can just create a control that prompts the user to name their file. However, if the filename already exists, an error occurs at the "close file" block. How do I go about prompting/displaying text on the front panel or even a dialog box that says "Filename already exists, please choose another" whenever this error occurs?


Hello,

 

I was out of the office yesterday, so I didn't see your message. As suggested to look nicer in notepad you can pad the header with spaces which is easier if you right click the string constant and choose " '\' codes display " and use \s for spacing. 

 

As for your save prompt issue, I use the "create file with incrementing suffix VI" instead of the "create file" as to never worry about losing data, as well as keep my data files organized. This allows for files to never be overwritten due to attempting to create a file with the same name as another.

 

Hope this helps

0 Kudos
Message 11 of 18
(979 Views)

Thank you those suggestions were helpful.


I attached another image and you can see a comparison between two sample data logging sessions. As you can see, the one with temperature column is improperly formatted whereas when I substituted a string constant with value "blank" it is formatted perfectly... I am wiring a result of a VISA read (a string) directly to the array and I am assuming that the temperature measuring device is sending some kind of new line termination character. Is there anything I can do to make the data log look like the one with the "blank" string? 

 

P.S. I opened the textfile also in Excel and as I suspected the wrongly formatted data wasn't on the same row, just like it looks like in the text file in notepad..

Download All
0 Kudos
Message 12 of 18
(954 Views)
Solution
Accepted by topic author laps682

@laps682 wrote:

Thank you those suggestions were helpful.


I attached another image and you can see a comparison between two sample data logging sessions. As you can see, the one with temperature column is improperly formatted whereas when I substituted a string constant with value "blank" it is formatted perfectly... I am wiring a result of a VISA read (a string) directly to the array and I am assuming that the temperature measuring device is sending some kind of new line termination character. Is there anything I can do to make the data log look like the one with the "blank" string? 

 

P.S. I opened the textfile also in Excel and as I suspected the wrongly formatted data wasn't on the same row, just like it looks like in the text file in notepad..


Hmm, as a first guess, and possibly wonky work around, try wiring the VISA string to a "spreadsheet string to array" function, then taking the resulting array, indexing it with a "index array" and feed that resulting element to the "build array". I would look at in more detail; however, I do not have labVIEW 2018. Can you File > Save for Previous Version to 2017 for me?

Message 13 of 18
(945 Views)

OK I will try that, please see the attached VI I believe it is 2017 now.

0 Kudos
Message 14 of 18
(941 Views)

@laps682 wrote:

OK I will try that, please see the attached VI I believe it is 2017 now.


That may not help at all, I'm just curious if it is fussing over it being a string. I'll look at the code.

0 Kudos
Message 15 of 18
(937 Views)

My LabVIEW is stilling saying it is in 2018 Smiley LOL

0 Kudos
Message 16 of 18
(936 Views)

Your guess worked! It is in nice neat rows now thank you once again. 

Message 17 of 18
(931 Views)

@laps682 wrote:

Your guess worked! It is in nice neat rows now thank you once again. 


Glad I could help! There might be an easier and/or prettier fix; however, if it works, it works! 

0 Kudos
Message 18 of 18
(926 Views)