LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric data stored as text in Excel

Solved!
Go to solution

Dear LabVIEW Community,

let me ask you for a help with the following problem. I save data from Table control to Excel file, using Microsoft Office Generation Toolkit. For this, I have template - basically, in the template Excel file there are up to 8 tables, and I need to write different data to them. So, I'm using the code, which I add into attachments - of course, it is slightly reworked for the forum, but in the application it uses the same code parts. Data is save to template, but - numeric values are displayed in Excel like text. And Excel "knows" that it is numeric values - and proposes to convert it to numeric, as you can see it from the screenshot... Formatting of cells, where I write data, doesn't help - b/c when I set up cells as "General" format (basically, numeric formate), it still says, that numbers were stored as text - b/c cells format is numeric, not text.
And what is more interesting - when I save not Table, but Numeric 2D array to Excle file via same function, I receive the same behaviour - numeric data is stored as text...

Maybe, I have some wrong settings in Excel. But maybe, it can be solved progrmatically. Could anyone help, please?

Thanks in advance!

Text to number.png

Excel problem.png

Download All
0 Kudos
Message 1 of 6
(4,309 Views)

I was not able to reproduce your finding.  One minor problem I had was that my PC uses the period as a decimal separator, and I didn't want to manually change your table.  I also didn't have an existing Excel file to use as a template, so I simply didn't wire the Template input of New Report.

 

There were no green triangles in any of my cells, whether I saved as in .XLS or .XLSX format.

 

I had seen this problem a few weeks earlier, but there I was using an Excel file loaded with macros.  By converting the file from .XLS to .XLSX, I was able to save it in a "macro-less" form, and the green triangles went away.  I don't totally understand it ...

 

I am using Office 2010, Windows 7 (64-bit), LabVIEW various (here I used 2013), 32-bit.

 

Bob Schor

0 Kudos
Message 2 of 6
(4,290 Views)

kosist90,

 

Have you tried to implement any other File I/O functions to duplicate the behavior, such as a Write to Measurement File Express VI?

Aaron L.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 6
(4,228 Views)
Solution
Accepted by topic author kosist90

The solution was simple, thanks to one guys, who helped me - it was needed to replace comma with dot. Afterwards, everything was saved correctly.

Excel problem solved.png

Message 4 of 6
(4,204 Views)

Let me be more specific, please - because I'm afraid, that people start think, that I use others ideas and show them as mine. The actual and specific answer on the question I've received on another forum http://www.labviewportal.ru/viewtopic.php?f=49&t=8179 - if you know Russian, you can check it. Some forums doesn't allow to post links to another similar resources, and I'm very lazy to read rules of NI forum to find out, if it is allowed.
Bob_Schor, thank you for your reply on this topic, but, unfortunatelly, it's not you who helped to solve it: because if we talk about decimal separator - I have comma for system decimal separation, not dot. And now - I have numbers with comma, convert them to be with dots, and in Excel they are displayed with comma. I do not need to change decimal separation in the Windows settings.

That's why I couldn't mark solution of Bob_Schor - who already helped me, it seems, with some another question- because from his post was not clear what to do to solve the problem.
And yes, as I wrote upper - I didn't sovle this problem by my own. But it was solved on another resource. That's why I described the solution here, and marked it as a solution - b/c next time, if someone will face the same problem, he wouldn't know what to do.

0 Kudos
Message 5 of 6
(4,170 Views)

It works great for german Excel!

Thank you!!

Piet

 

0 Kudos
Message 6 of 6
(1,577 Views)