read excel cell value

I write a procedure to read the values in Excel this procedure is:

Procedure p30_9i_read_Xls_file_OE_smr
IS
-Says handles OLE objects
request OLE2. OBJ_TYPE;
workbooks OLE2. OBJ_TYPE;
workbook OLE2. OBJ_TYPE;
spreadsheets OLE2. OBJ_TYPE;
worksheet OLE2. OBJ_TYPE;
cell OLE2. OBJ_TYPE;
args OLE2. OBJ_TYPE;

Check_file text_io.file_type;
path varchar2 (500);
Diretory varchar2 (500);
file_xl varchar2 (500);

No_File exception;
PRAGMA exception_INIT (no_file,-302000);
cell_value varchar2 (5000);
cell_value1 NUMBER (10.4);
EOD Boolean: = false;

l integer: = 1;
whole lb;
whole head;

the integer: = 1;
lend around;
whole tail;

BEGIN
lb: = 0;
head: = 0;
lend: = 0;
tail: = 0;
path: = "C:\Climate_File";
Diretory: = substr (:TRANSFERTS.file_name, 17, 22);
file_xl: =: TRANSFERS. EXCEL_FILE |'. XLS;
Check_file: = TEXT_IO. FOPEN(Path ||) '\' || Diretory. '\' || file_xl, 'R');
TEXT_IO. FCLOSE (Check_file);

-- -----------------------------------------------------------
application: = OLE2. CREATE_OBJ ('Excel.Application');
OLE2.set_property (application, 'Visible ','false ');
workbooks: = OLE2. GET_OBJ_PROPERTY (application "Filing cabinets");
args: = OLE2. CREATE_ARGLIST;
OLE2.add_arg (args, path |) '\' || Diretory. '\' || file_xl);
workbook: = ole2. GET_OBJ_PROPERTY (Workbooks, 'Open', args);
OLE2.destroy_arglist (args); -create args an arg list and initiate the arg inside

worksheets: = ole2. GET_OBJ_PROPERTY (workbook, 'worksheets');
worksheet: = OLE2. GET_OBJ_PROPERTY (application, 'activesheet');
OLE2. SET_PROPERTY (spreadsheet, 'Value', 'Sheet1');

-- -----------------------------------------------------------

args: = OLE2.create_arglist;
OLE2.add_arg (args, 2);
OLE2.add_arg (args, 4);
cell: = OLE2.get_obj_property (spreadsheet calculation, 'Cells', args);
OLE2.destroy_arglist (args);
cell_value: = oLE2.get_char_property (cell, 'Value');
p05_show_alert_message ("i = cell value ' |") TO_CHAR (cell_value));

-- -----------------------------------------------------------
-Release the OLE2 object handles
OLE2.release_obj (cell);
OLE2.release_obj (Worksheet);
OLE2.release_obj (Worksheets);
OLE2.release_obj (Workbook);
OLE2.release_obj (Workbooks);

OLE2. Invoke (application, 'Quit');
OLE2.release_obj (application);

-ASSIGNING of VALUE of RETURN of EXCEL to THE text field
-: PLANETS.pid: = cell_value;

EXCEPTION
WHEN no_file THEN
MESSAGE ("file not found.");
WHILE OTHERS THEN
MESSAGE (SQLERRM);
TAKE A BREAK;
BECAUSE me in 1... tool_err.nerrors LOOP
MESSAGE (tool_err.message);
TAKE A BREAK;
tool_err.pop;
END LOOP;


END;


-- ****************************************************************
My excel file also has the following features:
1 12.9 18.8 10.9 10 10.3 75
2 14.7 19.4 10.9 10 20.3 63

-- *****************************************************************

When I run my procedure to read the value of the cell:
OLE2.add_arg (args, 2);   -line 2
OLE2.add_arg (args, 4);  -column 4
I get 1 instead of 10.9 in output

OLE2.add_arg (args, 1);   -line 2
OLE2.add_arg (args, 6);  -column 4
I get 7 instead of 75 output
...

My problem is: any cell value, I choose to read, I'm just the first digit of the value of the cell.

any help, I appreciate it
Thank you.

software: form [32 bit] Version 9.0.2.9.0, oracle JInitiator: 1.3.1.9, WebUtil 1.0.2 (Beta), window, IE 8

Do this way:

args: = OLE2. CREATE_ARGLIST;

OLE2. ADD_ARG (args, r);

OLE2. ADD_ARG (args, c);

cell: = OLE2. GET_OBJ_PROPERTY (spreadsheet calculation, 'Cells', args);

OLE2.destroy_arglist (args);

-Returns the value of the cell

Cell_val (c): is ole2. Get_Num_Property (Cell, 'Value');

If Cell_val (c) = 0 Then

Cell_val (c): is ole2. Get_Char_Property (Cell, 'Value');

End if;

Still works.

When you insert dates in the table: to_date (Cell_val (5) + 2415019' I)

CHEK your desimal separator (, or) is language-dependent.

Tags: Oracle Development

Similar Questions

  • Read excel cell when excel is already open

    Hello

    I want to read a specific cell of a spreadsheet with excel already open. LabVIEW has only to read the cell and can't open excel.

    I have several examples that show:

    1. Labvview open excel

    2. Select excel file

    3. Select the workbook

    4. Select Sheet

    5. Select the cell

    6. read the cell

    7. close the workbook

    8. close excel

    In my vi I only need 3 to 6 step

    Thanks for your help

    Djamel

    The joint vi (LabVIEW 2012) will return the value in cell "A1" "Sheet1" of the already opened excel workbook "Book1".

    Change the values for your specific names in the workbook and worksheet and of cells needed.

    The value returned is a Variant needs to be converted with 'Variant to data' according to the type of data

    Ken

  • Read excel cells into variables

    I'm trying to read cells of an excel file and store the contents in variables. The idea is to pass information such as the numbers test, high/low limits, ect.

    I looked through the activex/excel samples and found excel2000dem which has a function called ReadDataFromExcel. I copied over the

    Excel2000.h file, most other variables and defines that it seemed to need. I get no error to generate/compile but when I SHIFT/F5, I have 7 errors of link

    for symbols not defined such as ' _ExcelSheetsItem @28' and '_ExcelWorkbooksOpen@208'. '.   I am new to LabWindows so I don't know how

    track down a link error. Can someone point me in the right direction?

    Mike

    Well, I think that I finally managed to pinpoint the problem. It seems that the file .c for this instrument has been disconnected. Here's how to fix it. Go to tools and select Edit. Then click Attach and Edit source. Recompile it and I hope that set the excel2000.c on the instrument. Go ahead and try this.

  • LabVIEW/excel: error-2147352567 in the value cell Value.vi

    Hi all

    I am facing an insoluble problem.

    I no longer write cell in excel.

    I developed my program under labview 2009 and made tests on two different PCs.

    On United Nations cell writing works on the other I always mistake-2147352567 in cell Value.vi value.

    I changed my pc and I went from XP to Seven, installed labview 2009, my program is still blocking on vi set the value of the cell.

    How can I solve my problem? program to recompile it?

    All feedback will be welcome.

    CDLT

    Hello to all,

    The problem of the modes of compatibilities between 2003 and 2007-2010.

    You can't manage files en .xls or .xlsx from the application.

    This little function a time but it does not last.

    The bathroom solution is to convert all your files in .xlsx extension and everything falls into place.

    This is the joy of Excel and to license software.

    A + pour discussion of another topic.

  • Link an Excel cell in a block of text in InDesign

    I hope to incorporate an Excel cell in a text box and have this value in the text box the file exchange linked Excel is updated. Imagine the following: "... There is a significant number of 123456 and the text goes here...". »


    So far, I could successfully change the preferences so that a linked Excel file is linked and can be updated, but it's an entire file, or range of cells in its own table.

    I have JUST the text in the cell appear (with no discernible denotation of its attributes) in the static text block and be linked to an update in the links Panel?

    Why is BTW that sometimes only the first two columns appear in the table?

    Thank you all


    This is the solution!

    A table online!  I made a small framed, linked to the cell, then makes an inline element in the paragraph of the text. Then it's just hair she and design.

    Thank you very much

  • The referenceing cell value against a form to anoter forms

    I have two forms of data. Form A and B. I'm writing the formula (columns added formulas) member in form B.
    I need to get A formula cell values. How reference to the cell in B forms.
    Such as in excellent we have 2 sheets and we can reference the a cell in another worksheet values. I'm doing it in the form of Hyperion.
    Please suggest me how I can do
    Thank you

    If she is separated, forms, then it will not work as the formulas are run on the active form, I thought that it would be possible with composite forms, but as I said, I didn't have much success.
    The other way, as suggested to have formulas in a member and access the Member between the forms.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • OnDrawingCell seems to be to delete all cell values

    I paint a capable 2D on a report that I did successfully with the result I want. It may be important to note that all cell values are expressions, not channels. It looks like this:

    My final step is to change the background color based on the value of the cell.

    Following the example "to help for orders for trend displayed in user Tables", I saved a script separate with the new command and put in place a column to use. On the test of the script, all THE contents of header cell has not disappeared from the table! Now, it looks like this:

    The new user control is in the HealthCellBackground.vbs file as follows. Note that currently all the contents of the command is commented on, which would theoretically result in any changes to the table and theoretically could not be hidden in bugs.

    void TabHealthOnDrawingCell (context, cell)
    Dim dCurrVal

    ' dCurrVal = val (Cell.Value)
    ' <= 9="">
    ' If dCurrVal > = 100 then
    ' Cell.BackgroundColor.SetRGBColor (RGB (50, 150, 50))
    ' ElseIf dCurrVal > = 25 then
    ' Cell.BackgroundColor.SetRGBColor (RGB (175, 230, 200))
    ' Else
    ' Cell.BackgroundColor.SetRGBColor (RGB (255, 50, 50))
    ' End If
    ' End If

    EndSub ' TabHealthOnDrawingCell

    The command is saved as:

    ' Saves a user REPORT function,.
    ScriptCmdAdd("D:\LabVIEW\Project\DIAdem\HealthCellBackground.VBS")

    The content of the script for this column is:

    Set o2DTableColumnExpression = o2DTable.Columns.Item (2)
    Set oColBG = o2DTableColumnExpression.Settings.BackgroundColor
    oColBG.ColorIndex = eColorIndexFillEffects
    oColBG.RGBFilling = RGB (147,225,225)
    oColBG.RGB = vbGreen
    oColBG.GradientDirection = eColorGradientHorizontal
    oColBG.GradientMode = eColorGradientModeFromInside
    o2DTableColumnExpression.settings.OnDrawingCell = "TabHealthOnDrawingCell"

    Commenting simply on the last line of the final snippet above will restore the cell values. The above images were generated by enabling / disabling just that character of a comment.

    Just for mental health, I tried to use the command in the example, TabTrendOnDrawingCell_Case1, and he gave the same results. Based on the evidence so far, something goes wrong with the record, either it is the contents of the cell as expressions that cause the problem.

    Any ideas?

    Hi gizmogal,

    I have reproduced a table with the expression of group name in your message and also had problems until I changed the scale of the entire table to have the right fixed number of lines.  If all you have are expressions, there unfortunately no way around to a static number in the number of rows in the table.  The expression Root.ChannelGroups.Count works to the right of the expression in the configuration dialog box you posted, but it does not work in the global table scaling tab, and that has to be right.  By default, DIAdem paintings list of 10 lines - my guess is that you had less than 10 groups in the data portal when you got this error.

    All 3 of your table configurations are expressions, if you need to list them as expressions, not variables.  A variable would be the name of a global variable that contains the information you want to display.  Unless you have created the global variable and filled with the value you want to display, you cannot use a configuration of variable type.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • read the independent values in a channel

    Hello

    I want to read the value of a chanel.

    I guess that every chanel's store as an array with an index and a value.

    I would like to read a value of a chanel with its index number, then do some calculations, and then write to it.

    For example:

    Chanel 1:
    index value
    1           1
    2           1
    3           1
    4           2
    5           1
    6           1

    start index = 0
    value > 1?
    If no control of the following
    If so do something

    Do you have a sample script to read a unique value in a chanel?

    Kind regards

    Frédéric MANUAL

    OK, so it should work

    Dim oChn, K, value
    "Go to the channel you are interested in.
    Set oChn = data. GetChannel ("Time")

    ' loop through all the values
    For K = 1 To oChn.Size
    Value = oChn (K)
    If (value > 1) then
    "do something
    MsgBox ("value WG 1")
    End If
    Next

  • Read the output values after each step runs in the User Interface of LabVIEW

    Hi all

    Development environment: TestStand 2010 SP1 and LabVIEW 2010 SP1

    Problem: is there a way to run the following steps programmatically and get values out of each of them?

    I have already extended a bit a complete interface IO for TestStand load any sequence, choose among the measures and execute step by step (something as an alternative to the steps run selected). What I'm trying to do is to add some actions between each step and do in the UI (I can't change the sequence!), so I start the NewExecution with some previously configured InteractiveArgsParam and option breakAtFirstStep set to true. Eventually I do just something like step over when debugging the sequence and it works well, but I didn't do well a way yet to read the output values of the place...

    So, if I wait before the end of the run I can read my results by treating the ResultObject, but it works only after the completion of the test sequence. Because I wanted to stop after each step, read the values, do some actions and continue to the next step, I've tried to register a running Trace event reminder View Manager. I see that after each step is executed, this event is fired, but when I try to read that a ResultObject returned in the event data it is not filled with values (ResultList seems to be empty?). Is this a correct behavior or maybe I'm reading the wrong way? (It's the same VI regarding the reading of the ResultObjects after the sequence ends and there it works very well for tables, containers and other types of data).

    As I mentioned I can't change Test sequences, I can not add a UImessages.

    What are my options? If the trace event returns output all the values from each steps or is it just used to check the status? Or maybe there's a completely different approach to this issue?

    Thanks in advance for your suggestions,

    Best regards.

    When you manipulate the UIMessage trace (you need this before the return of the event or you will present the race conditions), download myuimessage. Thread. Then call Thread.GetSequenceContext (0, & Iplease).

    And then on the context of the sequence, either go to PreviousStep.Result if it exists, or watch Locals.ResultList.

    Trace events occur between the steps executed step the more recently is the previous step, but it is also a trace event to the beginning before any measure have run at this time, there will be a previous step.

    Hope this helps,

    -Doug

  • Read the last value of a large file of PDM

    Hello everyone!

    I hope someone can help out me with this one.

    I try to put in place a program that can read the last value of one of the large channels of different TDMS files but I just can´t find a way to do it.

    I would appreciate help for my little problem.

    Thank you very much in advance for your support.

    Kasim.

    Hello

    You can use the following playback TDMS Set Position feature included in the PDM API.  This function receives a parameter called "(0:start)", which can be set to 1 to go to end of the file.  In this way, you can read the last value written to the PDM file.

    I hope this helps!

    Anuar Rojas

  • All excel cell number format using "excel cell format.vi set.

    Hi all

    I am writng 12 numbers to Excel cell, but it seems to me that 2.00207E + 11 instead of 200207106040. I use entire excel function cell phone format.vi but it is not useful, because I have no number format...

    Reference in the image file setting a VI.

    Thank you

    Got the answer.

  • MAX is reading my PLC values as decimal type, but they are BCD

    I have a Koyo sold by Automation direct plc.  All values of the automaton are BCD, but in the measurement and Automation Explorer, they are read as decimal values.  Does anyone know how to convert, OPC server is on the MAX so that I can read my values, because they are?  The database of the Citadel is useless for me without eigenvalues.  Belvedere offers the possibility of advertising ": b ' to your tags to read as BCD.  LabVIEW tools and it offers a similar way?

    Your opc server program should have a specific format for reading the data of the BCD. Here is some info for kepware.

    http://www.KEPware.com/KEP_KB/default.asp?TODO=view&questId=426&CATID=59

    There is an option to specify how the word is interpreted in the kepware opc server program. Here is the info of help files.

    Address of DL - 450

    Data types (default values are shown in bold).

    Type of memory

    Reference

    Types of data

    E/S

    X, Y, GY, GX

    Boolean

    Devices of

    S T, CT, C, MS,

    Boolean

    Data words

    V

    Boolean, short, Word, DWord, Long, LBCD, Float, String,.
    BCD (default for the timers and counters only)

  • Reading Excel data

    Hello

    I have a file in .xls excel format. I want to read the data of this daughter.

    most of the people said in the forum OR what convert .xls .csv file format and read data from «Read the file spreadsheet VI»

    Another option for read excel file without converting a .xls file in .csv format.

    Please help me

    Thank you

    Cedric Virpara

    Yes, you can use ActiveX

    https://decibel.NI.com/content/docs/doc-19913

  • How do I remove * error: failed to get cell value * in EN?

    is it possible that I can delete * error: failed to get cell value * financial reports... ?

    I use TxtCase and its gives me this error on the support of point of details...

    How to remove it... ?

    Thank you!

    You can try to delete the advanced, clear the error.

    Using the advanced in conditional removal Option

    Concerning

    Celvin

  • Procedure is not reading/returns all values

    The SP below reads in business_date as an input parameter.
    The procedure should calculate this value MAX in a range
    (ln_business_date) and this value must be used throughout the rest of the
    operating mode.
      SELECT MAX(business_date
          INTO ln_business_date
          FROM proof;
    The procedure returns the name of 'missing_tbl_name' of the INTO clause as the OUT parameter
    However, the performance of the SP_MONTHLY_ASSET procedure below I don't get not all values. The procedure
    Compiles without error but I think that my procedure is bad work and not read or return values
    correctly.

    Any help is greatly appreciated.

    CREATE OR REPLACE PROCEDURE SP_MONTHLY_ASSET(
        business_dt_num IN NUMBER DEFAULT NULL, 
        missing_tbl_name OUT NOCOPY VARCHAR2
    )
    IS
       ln_business_dt_num NUMBER;
       bad_date_value EXCEPTION;
    BEGIN
       IF business_dt_num < 0 
       THEN
          RAISE bad_date_value;
       ELSE
        SELECT MAX(business_dt_num)
          INTO ln_business_dt_num 
          FROM sasor.dp_ca_proof@psasr
    
          SELECT data_table_name
          INTO missing_tbl_name 
          FROM ( 
             SELECT whatever 
             FROM tablename
             WHERE some_condition MINUS 
             ( 
             SELECT whatever
             FROM secondtablename
             WHERE business_dt_num = ln_business_dt_num 
              UNION 
             SELECT whatever 
             FROM tablename
             WHERE business_dt_num = to_number( substr('&datenum',1,6) || '01' ) 
             )
               );
       end if;
    EXCEPTION
        WHEN bad_date_value 
       THEN
          raise_application_error ( -10001, 'Incorrect date ...');
    END;

    There is an exception no_data_found because there was no data found. This subquery:

             SELECT UPPER(data_table_name) data_table_name
             FROM filespec
             WHERE data_table_name IN ('SSBBALIN', 'LPLAPRA',
             'DSTASSET', 'EDJBALIN', 'APLASSET', 'HARTFORDDC',
             ' WLFBALIN', ' MSTBALIN', ' STFAPRA', ' RJABALIN',
             ' JYMAPRA', ' RBCBALIN', ' UBSBALIN',
             ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN') MINUS (
             SELECT UPPER(fus_data_table_name)
             FROM dp
             WHERE business_date = ln_business_date
             AND fus_data_table_name IN (' SSBBALIN',' LPLAPRA',
             ' MGNAPRA', ' DSTASSET', ' EDJBALIN', ' APLASSET',
             ' HARTFORDDC',  ' MSTBALIN', ' STFAPRA',
             ' RJABALIN', ' JYMAPRA', ' RBCBALIN', ' UBSBALIN',
             ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN')
             GROUP BY UPPER(fus_data_table_name) UNION
             SELECT UPPER(fus_data_table_name)
             FROM dp
             WHERE business_date = to_number( substr('201111',1,6) || '01' )
             AND fus_data_table_name = 'HARTFORDDC'
             GROUP BY UPPER(fus_data_table_name) )
    

    Nothing found. If you want to return just ' lack of support: "If the subquery is empty when what you need is:

    BEGIN
      SELECT 'Missing Load : ' || data_table_name
           INTO missing_tbl_name
          FROM (
             SELECT UPPER(data_table_name) data_table_name
             FROM filespec
             WHERE data_table_name IN ('SSBBALIN', 'LPLAPRA',
             'DSTASSET', 'EDJBALIN', 'APLASSET', 'HARTFORDDC',
             ' WLFBALIN', ' MSTBALIN', ' STFAPRA', ' RJABALIN',
             ' JYMAPRA', ' RBCBALIN', ' UBSBALIN',
             ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN') MINUS (
             SELECT UPPER(fus_data_table_name)
             FROM dp
             WHERE business_date = ln_business_date
             AND fus_data_table_name IN (' SSBBALIN',' LPLAPRA',
             ' MGNAPRA', ' DSTASSET', ' EDJBALIN', ' APLASSET',
             ' HARTFORDDC',  ' MSTBALIN', ' STFAPRA',
             ' RJABALIN', ' JYMAPRA', ' RBCBALIN', ' UBSBALIN',
             ' MERRILL_UMA_MAN', ' MERRILL_MAA_MAN')
             GROUP BY UPPER(fus_data_table_name) UNION
             SELECT UPPER(fus_data_table_name)
             FROM dp
             WHERE business_date = to_number( substr('201111',1,6) || '01' )
             AND fus_data_table_name = 'HARTFORDDC'
             GROUP BY UPPER(fus_data_table_name) ));
    EXCEPTION
      WHEN no_data_found THEN
        missing_tbl_name := 'Missing Load : ';
    END;
    

Maybe you are looking for

  • Pages will not open documents

    Hi all I have version 5.6.2 pages on a macbook pro Ox El Captain 10.11.6. Suddenly, last month, pages began to refuse to open a specific document, not all, just a. But today, he refuses to open another. The documents that we are talking about are "co

  • Security options for Hotmail (once offered Standard or high-security)

    Last year and this year, by signing on Hotmail one option has been provided for Standard or high security.  I don't recall that consisted of a statement of what the definitions of 'Standard' or 'High security' or that the option has been removed. Ple

  • (Redirected) inspiron 518 starts and continusly rings 4 times

    my inspiron on and just will power sounds 4times infallibly I changed the battery, but it won't do anything but beep and the custom display anything on the screen

  • BlackBerry smartphone WiFi issues BONES v6

    Hello, I recently got a Blackberry Bold 9700 with OS 6 with AT & T. I want to browse the internet with WiFi only, I have set up my connection and the WiFi light is displayed in the upper right corner.  When I disable my data service and try to connec

  • Replace color replaced by Dark, perhaps almost black instead of color I want

    Using Win7, CS6. When I try to replace color, say red with pink, the target turns dark, almost black. I tried every setting I can think, but I can't work. Any thoughts would be appreciated