Find no records in an Excel sheet

Hi all

I am importing data from an excel file into oracle database. I wanted to know the number of records in an excel file and no columns using oracle webutil (Client_ole2). I received a web code that works very well, adding a NEM statement at the end of the file each time. Maybe it's not practical always, cannot ask user each time to add a statement of NEM, which in turn result in program to run infinitely.

This is the code that is running

DECLARE

application Client_OLE2. Obj_Type;

Client_OLE2 workbooks. Obj_Type;

workbook Client_OLE2. Obj_Type;

Client_OLE2 spreadsheets. Obj_Type;

worksheet Client_OLE2. Obj_Type;

worksheet2 Client_OLE2. Obj_Type;

cell Client_OLE2. OBJ_TYPE;

Client_OLE2 args. OBJ_TYPE;

cell_value varchar2 (100);

num_wrkshts NUMBER;

wksht_name VARCHAR2 (250);

EOD Boolean: = false;

j integer: = 3;

v_fName VARCHAR2 (250);

worksheet_count number: = 0;

BEGIN

-Get the name of the file to open

-v_fName: = "D:\MyDevelopment\Forms\Samples\WebUtil\Read_Excel\planets3.xls";

v_fName: = WebUtil_File.File_Open_Dialog)

directory_name = > "C:\". »

-, file_name = > Get_Form_Property (:System.Current_form, Form_Name) |'. XLS

, File_Filter = > null

, Title = > 'Select customer filename to open.'

);

IF (v_fName IS NOT NULL) THEN

-The following sets a communication with the excel worksheet

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

-Open the OLE application

application: = Client_OLE2.create_obj ('Excel.Application');

-Keep the hidden application

Client_OLE2.set_property (application, 'Visible ','false ');

workbooks: = Client_OLE2. Get_Obj_Property (application "Filing cabinets");

args: = Client_OLE2. CREATE_ARGLIST;

-Open the selected file

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

Client_OLE2.add_arg (args, v_fName);

workbook: = Client_OLE2. GET_OBJ_PROPERTY (Workbooks, 'Open', args);

Client_OLE2.destroy_arglist (args);

worksheets: = Client_OLE2. GET_OBJ_PROPERTY (workbook, 'Worksheets');

-Get the number of spreadsheets

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

num_wrkshts: = Client_OLE2. GET_NUM_PROPERTY (worksheets, 'Count');

worksheet: = Client_OLE2. GET_OBJ_PROPERTY (application, 'activesheet');

-Go to the first record

go_block ('EXCEL_EXPORT_TABLE');

premier_enregistrement;

loop

If: system.record_status <>'NEW' then

create_record;

end if;

When the exit NEM;

for 1.15 k loop - 15 frames / record - hard-code the length of the column

args: = Client_OLE2.create_arglist;

Client_OLE2.add_arg (args, j);

Client_OLE2.add_arg (args, k);

cell: = Client_OLE2.get_obj_property (spreadsheet calculation, 'Cells', args);

Client_OLE2.destroy_arglist (args);

If Client_OLE2.get_char_property (cell, 'Value') = 'null' then

cell_value: = ";

on the other

cell_value: = nvl (Client_OLE2.get_char_property (cell, 'Value'), 0);

end if;

If upper (cell_value) = 'NEM' then - the loop runs until "NEM" are judged.

Nem: = true;

Message ('end of data');

"exit";

end if;

Copy (cell_value, name_in ('system.cursor_item'));

next_item;


end loop; -for

j: = j + 1;

end loop;-main loop

premier_enregistrement;

-Release the handles object Client_OLE2

IF (cell IS NOT NULL) THEN

Client_OLE2.release_obj (cell);

END IF;

IF (spreadsheet IS NOT NULL) THEN

Client_OLE2.release_obj (Worksheet);

END IF;

IF (spreadsheets IS NOT NULL) THEN

Client_OLE2.release_obj (Worksheets);

END IF;

IF (worksheet2 IS NOT NULL) THEN

Client_OLE2.release_obj (worksheet2);

END IF;

IF (workbook IS NOT NULL) THEN

Client_OLE2.release_obj (Workbook);

END IF;

IF (workbooks IS NOT NULL) THEN

Client_OLE2.release_obj (Workbooks);

END IF;

Client_OLE2. Invoke (application, 'Quit');

Client_OLE2.release_obj (application);

ON THE OTHER

Message ("no file selected.'");

message(' ');

RAISE Form_Trigger_Failure;

END IF;

END;

Please think it has no integrated to find no records and columns in excel file using oracle forms.

Thank you and best regards,

JaKes

This change according to excel data file.

for example, we also use this logic. because the first column in excel file still does not empty. It should be full.

If any column of a raw material can be empty, one with just my solution can be

v_all_column_str: = col_A_Value | col_B_Value | col_C_Value | col_D_Value |... col_n_value;

if v_all_column_str is null, then--> you can tell, all of the columns of this vintage in excellent file is empty

Tags: Oracle Development

Similar Questions

  • generation of Excel sheet

    Hello

    I want to generate the serial number and the frequency of the values in an Excel sheet. But I get the serial number and frequency down names and values at the top. I have attached the vi here. Please find. I want the s. n and frequency of headers high underrespective and values.

    Hi vipul,.

    the code was edditted his work as u wanted as u used the whole order in the loop has been reorganizing data and header as well so u Finally, received header

    now, the starting value get incremented each time and so there is no need to set the order in the loop, so for your reference without deleting the game order.vi I used a case of false and done a sixth death you can remove the order.vi set once u go through the code. I enclose her updated the code of his work like u wanted.

  • How to reset the default mail program? When I click to send e-mail to a box of 'Contact us' site web or excel sheet spread with addresses e-mail, a new msn email opens.

    How to reset the default mail program? Got msn.com. Now, I went to q.com. When I click to send e-mail to a box of 'Contact us' site web or excel sheet spread with addresses e-mail, a new msn email opens. Now, I get an error message: rundll32.exe - bad Image, followed by a message the the appklication or the DLL C:\Program FIles\MSN\MSNSharedFIles\MAILMAPI. DLL is not a valid Windows image. Please check against oyur installatiion diskette. I have msn unisnstalled.

    I can access my e-mail through hotmail msn, but no linger to subscribe to msn premium.

    original title: default e-mail program

    Hi PAULKRISSEL,

    This function is not supported natively in Windows. You may may find a third of the program that will change the default to q.com.

    WARNING:
    Microsoft provides no assurance or warranty, implied or otherwise and is not responsible for the download you receive from the sites of third parties or support related to the download or the downloaded technology. If you need assistance dealing with third party technology, please contact directly the manufacturer.

  • Select the cell &amp; Excel sheet

    I currently have hundreds of files that have 3 excel sheets.  Some files have been saved with the first worksheet open, others when the second sheet is open and some when the third sheet is open.  When one of these files is automatically opened it opens to the sheet that was displayed when it was last saved.

    I need to write a LabVIEW program which opens each of these files, formatting, makes sure that a1 is selected cell in each leaf and make you the first sheet is open when it is saved, so that it opens with the first sheet showing.  I'm new to ActiveX, but I already understood the formatting, and I do the formatting in worksheets 3.  I just can't understand how to choose which cell is selected and which sheet is displayed.

    Thanks for the help,

    Jeremy

    Try the attached VI.   It was adapted from:

    http://zone.NI.com/DevZone/CDA/EPD/p/ID/60

    I had to change the content of the cell on the worksheet that is desired to keep this sheet on top when recording.  You could probably just change an attribute (font size, etc.) if it is not desirable to change the contents of the cell.

    Note: the name of the journal that is selected on the front panel is the sheet that will be on the top of the opening.

  • Help update the values to modify files on Excel sheet

    I have an excel sheet containing a list of values that need to be updated daily. Cells that have values are related to certain cells in a separate file. The problem is that the file that gets my excel sheet is constantly updated values of as well as the file name. I want to create a macro that will be able to grab the values from the new file and update the spreadsheet I have. I tried to create a macro when you type the name of the file you want to the linked cells to, and she copy that and replace a formula that is already defined, so I'll be able to get new values. I'll show you an example below.

    Front of Macro

    Enter the name of the file: 12345

    (Part 1): = 'S:\MATERIALS\RAW matiere\ [135.xlsx] PURCHASE! $D $11

    During the Macro

    Enter the name of the file: 12345

    (Part 1): = 'S:\MATERIALS\RAW matiere\ [12345.xlsx] PURCHASE! $D $11

    (replaced the file name 135 with 12345)

    When I did that it worked, but my problem is that whenever I entered a new file name so that it is updated (for example 987), the cell would just update with the file I recorded the macro with (12345).

    If someone has a code VBA or other suggestions, I would really appreciate it! If you need me to explain more about this, feel free to let me know. Thank you

    The command of VBA macro to set the formula in a cell is:
    Range ("a6"). Formula = "= 1 + 1.

    This would create cell A6 of the formula "1 + 1 =", and the cell afficheraient a 2 it.
    Here is a full function VBA, you can use and customize.  Simply paste in your VBA Editor to use.  You can see the string which is the formula is to break with the prompting text in the middle.

    Void macroFunctionName()
    As Variant Dim promptText
    promptText = InputBox ("What number to the file name?", "Type number please")

    Range ("a6"). Formula = "='S:\MATERIALS\RAW matiere\ ["promptText & ".xlsx] PURCHASE '! $$D 11 "
    End Sub

  • 39028 error is generated when an excel sheet is uploaded

    A 39028 error is returned when an excel sheet is uploaded as a new database to the .rpd file.
    The error indicates that the features of the database does not match with default values.
    Can you please explain the reason for the error?

    Hello

    are you using Excel as a data source for server bi? does this mean by downloading?

    In any case, make sure you are able to display data in the physical layer for any column or a table?

    If so, double-click the zone database file or object (i.e. first folder in physical layer), go to the features tab.
    The bottom of the window, you will find the option-> back to the default values
    and click OK...

    Closes all cursors and cache. Check now

  • store data in a table in excellent sheet and e-mail

    Hi all

    I just wonder, I m do not know where to start. I want to insert data from a table in an excel sheet to spread.

    I work on a stored procedure with input parameters 3:
    1. the actual query
    2 user name
    3. the headers of columns (separated by commas) - these will be in the same order as the outer select statement in the query itself. I'll use the column headers for the columns in the Excel worksheet.
    When the procedure is run, excel is filled. If the number of records is 65536 >, then I need to create multiple worksheets in the same excel file.

    How can I do? Can any body please help with this... ?
  • I can't find the recorded files recently in my document folder

    I can't find the recorded files recently in my document folder

    Maybe not save them there.

    Assuming that you have saved the today, go to the Finder, type 'Today' in the oval at top right.

  • Excel sheet can not be changed op OSX machines

    We received an Excel spreadsheet for tracking working hours. This Excel sheet works fine on all devices Microsoft with Office 2010-2016.

    When we try to use the same sheet Excel on a Mac Excel sheet can not be filled. Excel keeps saying that it is secured by a password? We tested it using Office for Mac 2011 and Office 365 2016 for the Mac. The file itself is reading/writetable.

    We asked the original sender if password protected Excel sheet, but he said that wasn't the case.

    Any ideas what could be the problem?

    -check if we can open the spreadsheet on different Windows platforms (Win 7, 8, 10) which works well

    -check if we can open the excel sheet on the different versions of Microsoft Office on Windows (office 2010-2013-2016) computers that works well

    -test on an iMac to edit the spreadsheet with the latest version of El capitan with Office 2011

    -test on a Mac mini to edit the sheet with the latest version of El capitan with Office 365 2016 Office for Mac version. Test not OK.

    -test on an iMac 27 "to edit the spreadsheet with the latest version of El capitan with Office 365 2016 Office for Mac version. Test not Ok

    Try asking at your office for issue of Mac at the office for Mac forums where the Office of the Mac gurus hang out.

    http://answers.Microsoft.com/en-us/Mac

  • Satellite A500 - 13W HD4600 v8.634.1.0 ATI works very slow with large excel sheet

    Hello

    I have the problem that my old IBM T43 in the very fast work of the factory with some Excel sheets. My Toshiba and more recent need spend a lot of time the term of the leaves.

    I don't know if the video may be the problem, or...
    1.

    Anyone know how I can test the video?
    How fast it works with excel?

    I use the updating of toshiba, so I hope I have the drivers actually.

    Thank you very much

    Jürgen

    Hey,.

    Do you use the same version of office on two laptops? Normally the A500 is equipped with Office 2003 and Office 2007 version of trial and that s a little more slowly or more, in my opinion. So this could be one of the reasons for this.

    In addition, you play a little with the power settings. Try it with balanced and efficient fashion. It is best to watch videos and play games.

    If you have a large Excel files, try to defragment the HARD drive. It is always useful.

  • Read and display an Excel sheet

    Hello LabVIEW community.  I am going through a bumnch of subVIs ActiveX, trying to figure out how to do something very simple.  All I want to do is read a whole Excel sheet and display it in a table.  Single page.  Any help would be hot.

    camerond wrote:

    Freeshape wrote:

    Is it possible to program this example to read simply all the columns and rows until it crosses like maybe 3 repetitive empty cells instead of having to explain what row/column ends at?

    Sure. Give it a shot and let us know how you solved it.

    Cameron

    You are right!  It has been possible.  Use of loops and check to see when the cells begin to repeat.  I named it GetXL_CellValues_2D_String_All.vi

    I've done mine if lots of my excel sheet.  It is easy to make independent excel sheet.

  • LabVIEW 2015, some of the Excel worksheet data moving to another Excel sheet

    Hi, guys.

    I want to achieve functional on the transfer of data between the Excel sheet.

    For example I get addresses of the cell, then the data in the passage of the address to the other Excel sheet a particular cell.

    What can I do? Thank you.

    Report generation Toolkit a buit in VI you can use for your fact condition, but its an add we toolkit to separate license.

    ActiveX doesn't require external tools, but need to create your own LabVIEW Code using properties and methods.

    Look at this thread which will be useful for creating custom code using Activex.

    http://forums.NI.com/T5/breakpoint/Excel-Board/m-p/379682/message-UID/379682#U379682

  • View the Excel sheet in LabVIEW

    I have a series of files MS Excel 2007 (xlsx) I want to integrate and display in LabVIEW 2012 selecting them individually. Currently, the only way I can see the spreadsheet in LabVIEW is to place my ActiveX container on the front panel, then "select ActiveX object' followed by 'create a file object '. The Excel sheet then fills the ActiveX container and that is exactly what I want my face to look like. However, I don't seem to be able to 'Create a file object' programmatically using nodes and must manually bind each file to display my result in the ActiveX container. I'm sure I'm missing something and any suggestions on how to do this would be by program greatly appreciated - thanks in advance!

    Original Excel file example

    Inserting an ActiveX container and select 'create a file object '.

    Below desired result!

    «"" "Exceptional teamwork.»»"»

    Thank you for closing the loop of Tim.  Nugget that upward, tag it and be sure OP brand the solution-It takes some work to track him.

  • Insert new data to a new line in the same Excel sheet in continuous

    Hello world

    I'm using LabVIEW 2010 and there is a problem, I need to ask the subject to export the LabView to Excel data. Basically, I could transfer data "once" once on a new or selected Excel worksheet, but can only be 'IMMEDIATELY' when I run the VI, so my problem is, I need the data to be inserted at a same Excel sheet whenever I press run and the new data will replace not the former, instead go to the next new row or column. I really need answers regarding my problems, suggestions and ideas are welcome.

    I have attached my current VI and a picture describe the outcome that I needed

    Thank you for answer


  • Interpolation with input from excel sheet

    Hi all

    I am doing this in labview 8.5, what I've done in matlab.

    Basically I have two parameters x and y, and the function f (x, y) = z

    The data are available in excel sheet. In matlab, I can just read the excel file, use the interpolation function, and I got the answer.

    How can I do the same thing in lv 8.5?

    First problem is how to read a specific line and a specific column in excel and import them to lv?

    The value of z will be 2D array, how to import for lv?

    I think for the tween, I can use interp2D (1 d xi, yi).

    Try this

Maybe you are looking for

  • Recovery of Backed up on icloud without

    I regularly backup on iphone and ipad with icloud. I don't know how to access the part of this backup on my Safari browser on iphone. icloud.com url only works on a Windows laptop Thank you Geoffrey

  • Where's my mail?

    I opened mail after updating to 10.11.2 and all my mail is missing in my mailbox, I created. Anyone know where he went?

  • Error adding network printer

    I created, deleted and created again, a printer in network in Server 2008 Standard.  I shared out and I am able to see the printer in the list when you add a network printer using a XP 32 bit workstation.  When I try to add the printer from a worksta

  • Windows Easy Transfer fatal error

    In the past, I used Windows Easy Transfer to save and re - install the data when I had to reformat my Toshiba L650 / laptop Windows 7 Pro.  Now, whenever I try to access Windows Easy Transfer tells me that there is a fatal error.  How can I fix this,

  • iTunes Store 9 stop connection

    I don't know why but I get a loading message when trying to connect to iTunes store. I have not activated the parental control, I don't have blocking for Apple products in my firewall, I uninstalled the cleaner done reinstalled twice and I'm still no