How to get/append original excel file name and paste into new excel file name (Name must be same)?

Hi,

I am new to UiPath Studio and I am currently a intern at a local company. And I need help now as I am facing some issues as I need to get the original excel file name and write/paste into the new excel file name need to be the same file name.

Thanks!

Hi @phoenix123,

Do you want to copy the sheet from one excel to another or you want to copy the file name of one excel to another.

Because you are using Copy Sheet activity which copies sheet from one excel to another excel.

1 Like

@anil5 hi sir, I want copy the file name of one excel and paste into new excel file. So, I need to use which activity part of the excel?

@anil5 hi sir how to filter for the itemFiles.ToString(???) if I just want to filter out this part C:.…08_05_2019, only this name: Balestier-11 Apr not need to filter out.

Problem

Buddy @phoenix123

In your image excelfiles will already have the full path, hope you might have got that array from directory.getfiles(“filepath”,“fileformat”)
So in the last excel application scope remove the “c:.…” and mention as itemfile.ToString as it is not excefiles of array type, change that buddy. and i suggest there is no need for copy file as excel itself can create new file even if that file is not available.

Hope this would help yu

Cheers

1 Like

@Palaniyappan hi buddy I need get one of the specific name of the original file and past the name into the new as my company application restrict on this especially the name.

1 Like

@phoenix123

You can substring the itemFiles variable as

itemFiles.SubString(itemFiles.LastIndexOf(“\”)+1).Replace(“.xlsx”,“”)

Then you will get the file name separated from full path.

Hope I am addressing the correct issue.

Thanks,
Madhura

1 Like

Buddy you can get with this @phoenix123

itemFiles.ToString.Split("\"c).Last.ToString

Cheers

1 Like

@Palaniyappan hey buddy I try it work as expected but is there anyway can remove the .xlsx part and the code is?

Problem

1 Like

same buddy with small changes @phoenix123

itemFiles.ToString.Split("\“c).Last.ToString.Split(”."c)(0).ToString

Cheers

2 Likes

@Palaniyappan hey buddy for my case is working now! Thanks for your code! @Madhuraj @anil5 hey guys thanks for trying and for the effort to reply my topic! :slight_smile: You guys are awesome! Sorry that I am still a newbie to UiPath and still a intern at local company. Not really that pro in programming so in the near future, please guide me through. T T

1 Like

Cheers buddy @phoenix123

Keep going

1 Like

@phoenix123

All d best

1 Like

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

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