LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write 2d string array to excel worksheet in whole (not cell by cell)

Hello!

I want to write large(2000x2000) 2d string array in specified excel worksheet using activeX (there are several workseets in the workbook). I can do it with writing values cell by cell but it is unsatisfactory slow. Is it possible to write array to worksheet in whole (not cell by cell)? Is there somthing like property "Value" for excel worksheet?

0 Kudos
Message 1 of 6
(3,445 Views)

You could actually save the data to a text file, and then import it into the specified sheet using a QueryTable.

 

Basically you add a query table something like this:

 

     ActiveSheet.QueryTables.Add "TEXT;C:\Temp\temp.csv", Range("$A$1")

 

And it will import the contents of temp.csv starting at cell A1.

 

I think you then want to delete the query table afterwards.  Otherwise it will keep itself linked to the temp file.

http://www.medicollector.com
0 Kudos
Message 2 of 6
(3,414 Views)

Thank you!

I found the solution to my problem.

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

Hi Friends,

I too have a similar requirement. My VI generates multiple arrays (of large size each) and I need to write each array in to a seperate Excel Worksheet in a single Workbook.

 

With Cell value property (Referred in Examples) I could write into selected worksheets, but this method is very slow.

 

Please let me know how could you able to solve this problem...

 

Thanks,

R Ravi


@BPS wrote:

Thank you!

I found the solution to my problem.


 

0 Kudos
Message 4 of 6
(3,122 Views)

Hi R Ravi,

 

If you are using the Report Generation Toolkit, there is an example that demonstrates writing an array of data to an excel file. The example can be found by going to the LabVIEW Example Finder (Help > Find Examples...) and then navigating to Toolkits and Modules > Report Generation for Microsoft Office > Sample Report (Excel).vi


Milan
0 Kudos
Message 5 of 6
(3,095 Views)

Dear Milan,

 

I could get the example and able finish my task.

Thank you very much for the timely help.

 

Thanks,

R Ravi

 

 

 

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