Open and create data table

Hi everyone, please help with excel activity here…
So here is what is happening:
I open an excel file read it after reading it I have an ‘if’ statement to check on the particular row for an ‘/’ sign then if the row contains that it should write that in a new excel file,the data and the error there, please see the screenshots:


I receive an error that says :object not set to object instance

hello
have you iniate DT_Report
dt_report= new data table
or build your dt_report with build datatable activity

@Anelisa_Bolosha1 ,
check the Variables assigned Properly. The error may occur due to the Null value in the variable.
initially figure out which activity Error occurred, and print the suspected variables using Message box or Log messages.

Use Write range after the add data row or outside of the Loop

Also, Make sure you have used the Build data table for the DT Report.

If not, Craeye the build data table with column name before the Excel application Scope and use add data table in the Loop and use write range outside the For each loop

Hi, I created a datable outside the application scope


It writes in the datable: DT_notes


So it added the sheet name I created ,the one I am suppose to write to
Instead on the one I created,
image

First off, you shouldn’t do the For Each inside the Excel Application Scope. You should be doing…

  • Excel Application Scope
    – Read Range
  • end EAS
  • For Each Row
    – If
    ---- Excel Application Scope
    ----- Append Range
    ---- end EAS
    – End If
  • end For Each Row

Anyway, for your Add Data Row, you have not initialized DT_Report. In the variables panel for the DT_Report variable put New System.Data.DataTable in the Default property.

Thank you it worked, It is now able to write the data in correct file

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.