08-01-2018 05:26 AM
Dear Community,
Attached you will find the vi I am using to read an excel sheet containing approx. 2000x2 string entries. An interesting thing happening is that systematically every other time i get Error -2147024882, LabVIEW: (Hex 0x8007000E) Ran out of memory. I have not yet discovered what the reason behind this behaviour is. Any ideas?
Thanks in advance
Solved! Go to Solution.
08-01-2018 06:37 AM
i would be prudent to add your excel file
08-01-2018 06:50 AM
The think I forgot to mention is:
I am using LabVIEW 2012
Windows 7
And Excel 2013
08-01-2018 08:44 AM
Yes, we need to see the data that is causing what seems to be an abnormal termination. Because you attached your VI (thank you), we could tell you were using LabVIEW 2012.
Bob Schor
08-01-2018 09:44 AM - last edited on 08-02-2018 09:28 AM by LiliMcDonald
Here is the Excel File.
Rename the file in the VI please.
Admin Note - Removed attachment per user's request
08-01-2018 10:42 AM
OK, I see "a problem" (slightly different), but also a solution.
I'm running on a Windows 10 VM, with LabVIEW 2018 and Office 2013. Note that in LabVIEW 2018, "New Report" has been deprocated (I don't think it matters, but I used Create Report, the new function that drops the Standard Report). When I run your code against your Excel file, it basically seems to take forever (I generally abort-quit after a minute or so).
However, if I tell Excel Get Data to read from [0, 0] to [1999, 1] (by wiring Start and Stop inputs), the program finishes in less than a second with a 2D array of strings.
The RGT was really written to write reports. The "Read" for Excel is, I think, something of an after-thought that can work, but you need to be careful ...
Bob Schor
08-01-2018 11:31 AM
Hi,
checking the size of the "UsedRange" of your worksheet in your excel-files yield 16384 columns and 1977 rows.
That is quite a lot of cells to read.
Regards, Jens
08-01-2018 02:09 PM
@JensG69 wrote:
checking the size of the "UsedRange" of your worksheet in your excel-files yield 16384 columns and 1977 rows.
That triggered a memory of a similar problem I encountered (but forgot about!) a while ago. The UsedRange property of Excel Worksheets is strange and difficult to modify. But there's a trick:
I also tried it with your LabVIEW 2012 code running in LabVIEW 2018, and it behaves the same way (about 1.7" to read everything).
Bob Schor
08-01-2018 03:37 PM
08-01-2018 05:49 PM
As pointed out already, the problem is in your Excel file and not your code. The RGT is smart enough to default to the UsedRegion when the Start and End inputs are left unwired.
However, you can fix this issue in LabVIEW if you can't fix the problem with the Excel file. Just use the invoke node "Range" with property node "CurrentRegion" instead and set the End Location. Here is the VBA equivalent:
ActiveSheet.Range("A1").CurrentRegion.Rows.Count
ActiveSheet.Range("A1").CurrentRegion.Columns.Count
Use the RGT function Excel Get ActiveX References to obtain the WorkSheet reference.