From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Problem when working with Write to SpreadSheet

Hi again. I'm trying to export some adquired data (double) to Excel, I've found this tutorial in NI webpage: https://decibel.ni.com/content/docs/DOC-36448 and it worked but I have a problem: Columns are not separated when I run it. It would be much appreciated if you can help me, I think maybe its some Excel issue but I want to confirm it, thanks.

 

0 Kudos
Message 1 of 14
(4,484 Views)

It's probably a delimiter issue between columns. The rows are seperated by return/line feeds, so that's easy.

 

The columns are seperated by whatever you want, default is "\t" (tab). This is an input in to that Write to Spreadsheet VI, so wire whatever you want in there.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 14
(4,469 Views)

You have not shown your code, so it is difficult to test it or to point out where your error lies.  The first question ask is "How do you know the data are not separated?"  This is not a silly question -- my guess (and, without seeing your code to confirm this, is only a guess) is you left the default Tab character as the separator, then opened the resulting file (which is really a Text file, not a Spreadsheet) with something that ignored the Tabs.  Am I close?

 

Bob Schor

0 Kudos
Message 3 of 14
(4,462 Views)

The code is attached (is the same of the link I posted above). I tried adding \t delimiter to get separated columns in Excel but it didn't work.

0 Kudos
Message 4 of 14
(4,452 Views)

I ran that code you attached and it worked fine.

 

Did you change anything from that VI? A different file path, or something?

 

The filepath is for a".csv" file, which is a comma delimited spreadsheet that excel understands is comma delimited. It looks like that VI doesn't use the input "\t" delimiter, they manually did just a single column of strings where the individual strings had commas manually inserted. Ideally, you would use the 2D input to the Write to Spreadsheet VI and use the delimiter input instead of what they're doing.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 14
(4,446 Views)

I edited to actually use the delimiter inputs here instead of writing single comma delimited strings. Take a look:

datafile.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 6 of 14
(4,438 Views)

I haven't change a thing of that VI. I run it in LV2014, and when I open the .csv file I get that columns are not separated.

 

ni.jpg

0 Kudos
Message 7 of 14
(4,435 Views)

I also tried with your modification but it's the same. I suppose it's an Excel issue.

0 Kudos
Message 8 of 14
(4,421 Views)

The only thing I could think is that Excel doesn't see it as a comma delimited file. Does the file extension show up as ".csv"?

 

Edit: I mean, just in file explorer, how does windows recognize the file? I would suggest also looking at Excel's associated file types that Windows has set as well.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 14
(4,412 Views)

I wrote an array of real value unsing the same vi "write to a spreed sheet file". the data is place in a row but you can trans[pose the data within Excel.

Einstein proved by taking time in thinking about a problem he proved there is no such thing as gravitational pull. Therefore, given enough time and thought a problem can be solved. If the problem is not solved then there has not been enough thought.
0 Kudos
Message 10 of 14
(4,403 Views)