creating xls file in labview using read/write, the file you are trying to open xls is in a different format than specified by the extension

StackOverflow https://stackoverflow.com/questions/22206874

  •  09-06-2023
  •  | 
  •  

سؤال

I tried to create an xls file in labview 2010 as shown below: enter image description here

I get something like below in this excel file:

0.13    0.01    99
0.51    0.02    99
13.97   0.55    8.81
23.11   0.91    12.04
36.7    1.45    8.74
50.42   1.99    8.67

However, when I open excel I get the warning that:

"the file you are trying to open xls is in a different format than specified by the extension"

when I change the file to a .csv, I no longer get this error. But I need excel to open it in the xls format without the warning. Can this be done?

هل كانت مفيدة؟

المحلول

LabVIEW cannot directly write to an XLS format file.

  • You can write a CSV and open it in Excel (Excel will open a CSV file with a .xls extension, as you are seeing).

  • On Windows you can use the Report Generation Toolkit or one of the Excel automation interfaces (.NET/ActiveX) to tell Excel to write an XLS file with the values that you specify programatically. This requires that Excel be installed on the local machine.

  • In LabVIEW 2013 you can use the "Write to Measurement File Express VI" to write directly to XLS*X* files without having Excel installed.

  • There may be a non-NI support library or command line tool you could call but I'm not aware of one.

This document explains a little more: http://www.ni.com/newsletter/51339/en/

نصائح أخرى

If you need to write to .xls (not .xslx) format directly from LabVIEW there is a third party toolkit available from NI, but it costs extra.

Alternatively if you can use Python (for example) you could write a short Python script to convert a csv file to xls using the xlwt package, and call this from LabVIEW using System Exec. I expect there are similar packages available in other scripting languages.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top