Dynamic workbook name in Read Range activity, For each workflow

Hi,

I need to compile information from a group of Excel files in a folder. I’ve set up a For Each workflow to read every file in the folder, and then a Read Range activity to read the file. I can’t figure out how to listthe workbook path for the read range, as it will change every time. I’ve tried Item.ToString but it throws an exception.

Any ideas?

Thanks,

Item will give you full path of all the excel files in the list and when you provide it to read range, it will read the file (Assuming Systen.File.Workbook.Read range)

Try giving a message box before giving it to read range to check

Message box returns the correct file name and location. Does the string need to be split to remove the file location?

No, can you post the error you are getting @AceRenegade?

image

I hope you are not passing the value to the activity, so it showing the null reference error @AceRenegade

or the sheet name which you gave does not exists

image

That’s what I’m using @HareeshMR. Message box returns the correct file name as I said above.

Instead of Read Range, try passing the value to excel application scope and read range of the excel activities inside and check @AceRenegade.

That’s solved it, thanks @HareeshMR

Glad you got the solution @AceRenegade. I’m still confused why the read range of system activities won’t work there :slight_smile: … Need to know that

Perhaps because the files are .xlsx and not a simpler sheet such as .csv?

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