10-17-2017 02:52 PM
Hi everyone,
I am trying to write a 4x5 double array to an excel spreadsheet using the titular VI. However, when I try to do so and then open the resulting .xlsx file, Windows throws up an error message saying the file cannot be opened and may have been corrupted. This happens both when I specify an existing destination file and when I use the popup dialogue box to create one from scratch. The input array is very simple, and the VI is operating with the standard tab delimiter and %.d format. The array is assembled in a while loop, passed to subsequent loop iterations with a shift register, and then passed to the VI. No issues are present with the array itself, which looks like I expect it to. I would really appreciate some advice on this issue, as I can't figure out how something so simple could generate this error.
Thanks
Solved! Go to Solution.
10-17-2017 02:59 PM
The problem is that you call it a .xlsx file, but it is missing some stuff that Excel expects. If you change the file to .txt, you should be able to open it up fine.
If you really do need a .xlsx file, you should use the Report Generation Toolkit.
10-17-2017 03:04 PM
"Write to spreadsheet" has nothing to do with excel. If you want more detailed help, please attach a simplified version of your VI.
A file extension just defines which program is used if you double-click it in windows explorer. It does not define or verify a specific file structure.
(If you name it *.xls instead, excel might try to opend it, recognize it as delimited text file and load it, but this is not really recommended)
10-17-2017 04:25 PM
@AWS770 wrote:
Hi everyone,
I am trying to write a 4x5 double array to an excel spreadsheet using the titular VI.
Unfortunately, I "no hablo" spanish
10-17-2017 04:43 PM - edited 10-17-2017 04:43 PM
As the others have said an XLSX file is not a text file. XLSX is actually a compressed XML file format.
Just make it a .txt and Excel will be able to open it, and is will then "import" it giving you the chance to select the delimiter.
10-18-2017 02:51 PM
By putting the word "Spreadsheet" in a VI that LabVIEW provides that writes a Comma-Separated-Values (.csv) type of text file, NI has confused many LabVIEW users into thinking this is writing an "Excel" file. Well, Excel can open .csv files (and, in fact, prefers to "capture" this extension and misleadingly give it an "Excel-like" Icon). However, Excel is designed to work with its own proprietary file types, .xls and .xlsx. This confusion comes up repeatedly in the Forums ...
Bob Schor
10-18-2017 04:11 PM
@Bob_Schor wrote:
By putting the word "Spreadsheet" in a VI that LabVIEW provides that writes a Comma-Separated-Values (.csv) type of text file, NI has confused many LabVIEW users into thinking this is writing an "Excel" file. Well, Excel can open .csv files (and, in fact, prefers to "capture" this extension and misleadingly give it an "Excel-like" Icon). However, Excel is designed to work with its own proprietary file types, .xls and .xlsx. This confusion comes up repeatedly in the Forums ...
Bob Schor
Similar to the "String to Decimal Number" and "Decimal Number to String" functions. In these cases, as the case above, NI is technically correct, but confusing, because the colloquial uses of the terms are different.
When we think of spreadsheet files, we usually think of excel spreadsheets - but those aren't the only kinds of spreadsheet files. A .csv file is also a spreadsheet file. Hence the confusion.
When we think of "decimal" numbers, we tend to think of numbers with decimal points in them; however, technically it just means a base10 number. An integer, in other words. Hence the confusion generated when a new LabVIEW programmer uses the a node that I mentioned above and only gets integers and not fractional numbers.
10-18-2017 05:31 PM
@Bob_Schor wrote:
By putting the word "Spreadsheet" in a VI that LabVIEW provides that writes a Comma-Separated-Values (.csv) type of text file,
The default is tab delimited text.
To get a csv, you need to specify a different delimiter and potentially break things for international users (e.g. the ones that use comma a decimal delimiter).