Excel application scope - Value cannot be null


#1

Hi…

I wanted to open excel file where the filename is not static but i am getting this error while run the project. Can you please help to check and tell me what is wrong.Also i attached you my xaml fileOpen Excel.xaml (19.5 KB)

image


#2

do you log what the filename is after you assign it to ensure that it actually captures a filename?
Also do you check if the workbook path exists that you are trying to open?


#3

@Fizzy
I think the value of file name is empty or null
Can you explain what is that item
Regards,
Mahesh


#4

Item.FullName is Blank . Pls check that value and change it so that filename will contains some value


#5

may i know how to include the value in item.fullname?


#6

@MAHESH1
Basically, i wanted to capture any file name that have “Monthly Retailer Report” in the path that i set because every month the file name is different for example this month could be “1982 - Monthly Retailer Report” and next month could be “1922 - Monthly Retailer Report”.


#7

This error is observed when the filename you are passing for the ‘Excel Application Scope’ is empty.

‘filename = item.FullName’ doesn’t seems to storing any files path.
Try this ‘filename = item.FullName.ToString’

Thanks,
Rammohan B.


#8

@Fizzy

I think item is a file path.
Sry If it throws any exception, I have not tested this code

strFilePaths=(Directory.GetFiles("FolderPath")).Where(Function(x) new FileInnfo(x).Name.Contains("Monthly Retailer Report"))(0).ToString

then use strFilepath in ExcelApllicationScope.
Better Make sure that the file with that name should be there.

Regards,
Mahesh


#9

Thanks guys! The problem is solved now but i have another problem right now where i did not receive email when the status in Column ‘Status’ showing all ‘Generated’. Let me brief the activity, The robot should check row by row and confirm if all status is ‘Generated’ then it will send me an email mention “All Database is ready”.

image

image

Open Excel v.1.2.xaml (21.1 KB)


#10

Your if condition seems to be returning false due to that 18th row which has ‘Count=16’. Can you delete that and try, if its not required?

Thanks,
Rammohan B,


#11

@Rammohan91 Cannot delete that as the ‘Count=16’ indicate the last row. meaning the robot should check row by row to ensure all status are ‘Generated’ and the last row will have ‘Count=*’ so that the robot will know that this is the end of row and stop.


#12

Ok. So In that case if that row is always supposed to be there then i think you can use ‘DT.Select(“Status=‘Generated’”).Count = DT.Rows.Count -1’ for the if condition.

Thanks,
Rammohan B.


#13

@Rammohan91 thanks for that, it worked however i received multiple email for each row that “Generated”. i just wanted to have only one email that inform me All Database are generated successfully. Any idea?


#14

Hi @Fizzy

Your If activity that sends the email was inside the For each row activity. Just move it below that activity so it only runs after each row that “Generated” is complete.

Here’s my version 1.3 of your xaml to show what I mean but you’ve probably changed your code since the 1.2 you uploaded so it’s for reference only.

Open Excel v.1.3.xaml (21.5 KB)

Regards
Troy