update_recordset , insert_recordset, Delete records
/Select query in Dynamic AX 2012
 MyTable myTableBuffer;
Select myTableBuffer
where field1 == 0;
//use while select for multiple select

// Update query in Dynamic AX 2012

MyTable myTableBuffer;
update_recordset myTableBuffer
    field1 = 1,
    field2 = fieldX + fieldY
where field1 == 0;

//Delete query in Dynamic AX 2012

static void DeleteMultiRow1aJob(Args _args)
    MyWidgetTable tabWidget;
    delete_from tabWidget
        where tabWidget .quantity <= 100;

// Insert query in Dynamic AX 2012
insert_recordset myTable (Field1, Field2)
    Field1= “QWERTyuioP”
Field2 = “ASDFghjkl” ;

Import excel more sheet
I guess, you didn't help yourself with testing with a huge block.
I suggest writing a test Job to check a very small Excel file 2 Sheets, just 2-3 columns with 2-3 records. Try reading and info them.
Also, use same variables
workbook            =   workbooks.item(1);
   worksheets          =   workbook.worksheets();
   worksheet           =   worksheets.itemFromNum(1);
//TODO: Read first sheet
   worksheet           =   worksheets.itemFromNum(2);
//TODO: Read second sheet
Once you get this working, build your real data / file from there.
X2 click  open form detail - Default Action property on grids
Default Action property on the form grid control was added in AX 2009. It allows to specify a menu item from the form which will be executed on the double click event on the grid. Originally this feature targets list pages – it allows to open details forms for the selected record on the list page. However, it can be used for any grid on any form. The only limitation is that grid should not be editable.
Filter in form
void  init()
    str a;
    Query                   queryVersion;
    QueryBuildDataSource    qbdsVersion;
    QueryBuildRange         qbr;


    callerDrawingVersion    = element.args().record();
        throw error("Function is called incorrectly.");
    queryVersion = new query();
    qbdsVersion      = queryVersion.addDataSource(Tablenum(SCA_DrawingVersion));
    qbdsVersion.addRange(fieldnum(SCA_DrawingVersion, Drawingcode)).value(queryvalue(callerDrawingVersion.DrawingCode));