LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Excel cell data automatically

From the given examples, before reading an excel data, you have to specify the start cell and the end cell number. Is there a method to read out excel data just by giving the file name?

 

David

 

 

0 Kudos
Message 1 of 8
(5,115 Views)

Hi David,

 

I cannot understand what you are trying to achieve by "read Excel just by file name".

Excel is cell-oriented. Everything written in it belongs to some cell.

 

If you are sure the data is in cell A1 then go and read A1.

If your data does not need to be grouped in a table fashion, then write it in a ASCII text file, you do not need Excel in that case.

 

What do you want to do finally?

Maybe you can tell more about your application.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 8
(5,100 Views)

Well, you will be able to load an excel file with fopen() . But that's probably not what you want, because you have to decode ondisk excel format yourself then.

Could you describe more precise, what you want to achieve ?

 

0 Kudos
Message 3 of 8
(5,099 Views)

Sorry maybe describe cleared. In fact, my excel file is a  template, and just have one sheet, but the l row numbers will different, I do not want to import it into cvi table by specify the start cell and the end cell number each time, I need an interface to read all contents in the 1st sheet.

 

 

 

David

0 Kudos
Message 4 of 8
(5,092 Views)

Well, then you can open Excel, open the first sheet in the collection and then iterate into the sheet and search for non-empty cells.

You can use the source code for ExcelRpt_ReadDataToTableControl () function into excelreport.c code as a guideline to develop your own function: iterate on all cells in the sheet and try to load only those that do not return CAVT_EMPTY in CA_VariantGetType () function.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 8
(5,088 Views)

Thank you Roberto.

0 Kudos
Message 6 of 8
(5,069 Views)

Hi Robert,

I want to open an existing .xls file and read all cell values one by one  in a particular column.

example: in column E i want to read it in E1, E2, E3....so on manner by checking end of file also.

Could you please help me how to do it?

0 Kudos
Message 7 of 8
(2,429 Views)

I suggest you look at the examples that ships with CVI: you can either follow Excel-only way (excel2000dem is the sample to look at) or Excel Report, which is built on top of this and which most user find more handy to use.

In either case, ways to read back cells content from a workbook are given for you to test and adapt to your needs.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 8
(2,424 Views)