Need Help with Automation Flow Please!

I’m getting an error with the flow I created:

  • I used an excel application scope and placed the variable i created for the worksheet path

  • I then used a read range workbook activity to read a column in that file and save it in a DataTable variable. I used the same variable in ‘read range workbook’ activity that I used in the excel application scope for the worksheet path.

  • I’m getting this error: Excel Application Scope: Object reference not set to an instance of an object.

  • The goal of the flow is to open the excel file, open the PDF file in a sharepoint folder by using the column value stored in the DataTable variable. Then rename the opened PDF file using another column value in the excel file and then save it in another folder in a SharePoint directory.

  1. Ensure that the variable you are using as the worksheet path is correctly initialized and points to a valid Excel file.
  • Verify that the variable is not null and contains the correct path.
  1. Double-check that the worksheet you are trying to read actually exists in the Excel file specified by the worksheet path.
  2. Confirm that the variable you are using as the worksheet name within the “Read Range Workbook” activity points to a valid worksheet within the Excel file.

@Castiel_Helix

Hi

This error occurs when you’re trying to use an object or variable that hasn’t been initialized or is null. In your case, it could be related to the DataTable variable you’re using.

Initialize that datatable with default value like this
New System.Data.Datatable()
In variable panel

Also try running in debug mode and understand where the error is occurring by checking the variable values in local panel

Hope this helps

Cheers @Castiel_Helix

Hi @Castiel_Helix
Addition to this please check the scope of variable which you have created.

1 Like