Create Excel file if not exists

I am trying to write a dt back to an excel file but want to create a file with todays date from template if one does not exist.

I have selected “create if not exists” and indicated the template file but I keep getting the error “QueueItemLogs.xlsx 27\06 does not exist, please check the output path.”

I know the file does not exist because I am trying to create it.

Any ideas on why this might be failing?

Hi @b.forbes

If i understand correctly you are trying to create a excel file with name QueueItemLogs.xlsx 27\06. But if the file name is having \ , it will be considered as folder path, instead of \ in the file name you can try to use like QueueItemLogs_2706.xlsx

Regards,
Rajeswari

1 Like

Hello.

You can’t use \ in the name.
If you try to create it manually, it doesn’t work either.

Hug

image

1 Like

@b.forbes Try giving the file name like below. Remove \ from the your file path

"QueueItemLogs " & Now.ToString("ddMM") & ".xlsx"
1 Like

you cannot have “/” in the name of the excel. use now.tostring(“dd-MM-dd”) +“xlsx” on the end of your file name instead

1 Like

Thanks, changing "" to “-” worked. Should have noticed that.

This solved the issues.

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