LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting Data to an Excel File

Hello, I am currently trying to export data from a Keithley 2100 Series Digital Multi Meter (DMM) in the form of a 1-D array into an excel file automatically. I have tried using both the 'Write to Measurement File' and the 'Write Delimited Spreadsheet' functions, but both uses seem to generate the following error:

 

"Error -375701 occurred at Write To Measurement File->Keithley 2100 Series Read Multiple.vi"

 

The error description that follows is:

 

"LabVIEW: The Excel file is not generated by LabVIEW."

 

Both functions are giving me this error, and there seems to be zero documentation of this error on the National Instruments website. I was able to get around this issue at one point, but the destination excel file would be blank and would provide an error message that the excel file needed to be restored. I have attached a couple of PNGs of the basic set up for the my specific use of the functions. I made the file path a control for both, but I've tried using them as indicators as well and I get the same error in both cases. 

 

Thank you, and I appreciate any help!

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

FYI, Write Delimited Spreadsheet isn't for creating Excel files, just simple delimited files like CSV. The first thing you tried should work though.

 

Are you writing some weird data?

Can you get it to work as a small SubVI without the rest of your code?

Are you trying to create an excel file somewhere that you don't have write access to?

 

If you can't get it to work with a simple SubVI, then attach that simple VI here with the data set as a constant. If we can't get it to work here, then it might be an issue with your system.

The below code works for me to create a simple excel file. Give this a shot and, if it works, compare it to your code.

 

 

Create Excel File.PNG

Cheers


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

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


0 Kudos
Message 2 of 6
(6,323 Views)

Thank you James.M very much for the quick and helpful reply, your solution seemed to work and generate an excel with the appropriate data, and when I tried to connect it to the data retrieved from the DMM it worked! I think I now have a better understanding of how this function works, because I notice that if I manually edit the excel file that was created by this function, it won't work again, and I think this is what was causing the error.

 

I also found that when creating the function, I am able to append data onto the file if there is an existing file with data that had already been exported. The way data appends onto the excel file is into one single column, directly following any previous data, but I would like to be able to place new data in separate columns. i.e. for each iteration or use of the function, I would like to have the data appended to separate columns, and was wondering if there was a good way to do this.

 

Thanks again for the help!

0 Kudos
Message 3 of 6
(6,299 Views)

@megan63 wrote:

Thank you James.M very much for the quick and helpful reply, your solution seemed to work and generate an excel with the appropriate data, and when I tried to connect it to the data retrieved from the DMM it worked! I think I now have a better understanding of how this function works, because I notice that if I manually edit the excel file that was created by this function, it won't work again, and I think this is what was causing the error.

 


Excel will lock the file and prevent other programs from writing any data to them. This may be why the function won't work again.

Message 4 of 6
(6,289 Views)

I have faced with same problem. One of the reason is due to manually edited and saved file is connected.  I delete the file and create new file and connect, it works fine.  So, if you once edit and save the out put excel file, then you should not use it with the same measurement file again. It seems some what non sense but it works.

0 Kudos
Message 5 of 6
(5,544 Views)

With the exception of JamesM, all of the Posters on this thread use the term "Excel" incorrectly!

 

"Excel" is the name of a program written by Microsoft as part of their Microsoft Office suite.  It has a proprietary format that has the extension(s) .xls and .xlsx.

 

If you search on the Web for "Comma Separated Values", you will learn that this is a "delimited text file" where "commas separate the values".  Such text files are usually given the extension ".csv".  The company that makes Windows has decided that all files with the extension ".csv" should have an File Icon that looks like this:  CSV IconCSV Icon, whereas the Excel ".xlsx" Icon is XLSX Icon.png.

 

Many (LabVIEW) users are confused by the first Icon, thinking it has something to do with Excel.  It does not!  It can be opened by any text editor (like Notepad).  As it turns out, Microsoft Excel can also open it, but so can LabVIEW!

 

Curiously, however, LabVIEW's "Delimited Spreadsheet" functions, while they use the ".csv" extension by default, they do not use the comma as the character to "separate values" by default -- they use <tab>.  Who knows why/how this came about?  Not I, but it's been that way so long, it is unlikely to change.

 

LabVIEW does have the ability to open true Excel files (.xls or .xlsx), but requires either the Report Generation Toolkit, third-party packages, or a lot of work with ActiveX calls.  If you need to read or write a true Excel Workbook, I recommend the RGT, as it is well-documented, pretty capable, and fairly easy to learn.

 

Bob Schor

0 Kudos
Message 6 of 6
(5,535 Views)