Copy Header Activity Sometimes Failing Without Error Message

Hello,

I am having an issue similar to this poster’s here: Copy file activity not working correctly. I am trying to copy a header from a template file into another Excel. There are about twenty headers to choose from for each Excel file and about one hundred Excel files to update, which is why I decided to use this activity rather than a VBA.

However, sometimes the BalaReva.Excel.Sheets.CopyToFile activity fails without sending any error message. The header simply is not copied over, although the bot thinks it has been. As a temporary “solution”, I have the bot a) kill Excel right before the copy activity and b) check to see if the header has been copied over afterwards and alert me if it hasn’t so that I know to rerun that Excel file the next day. However, I would prefer to resolve this problem at its source.

Only a couple of Excel files fail to have their headers copied over each month, so it is not necessarily a huge issue, but it is noticeable enough to cause a bit of irritation from the department. This problem has plagued me for 3 months now.

Here are the steps of the process:

  1. The bot loops through GroupFoldersPath (“O:\DepartmentName\Group Reports”)
  2. For each Folder in GroupFoldersPath…
  3. The bot finds GroupInputFoldersPath (Folder.ToString+“\INPUTS”).
  4. The bot finds the current month’s input file (MonthlyInputExcel) in GroupInputFoldersPath,
  5. The bot reads the range of MonthlyInputExcel into a data table.
  6. The bot uses a switch statement to invoke the correct workflow for the current group.
  7. Each group’s workflow has a different VendorNumberArray. For each item in the VendorNumberArray…
  8. The bot filters the data table it read earlier by item/vendor number and sums up the costs.
  9. The bot copies the header over into the OutputFile (GroupFoldersPath+“"+item.ToString+” “+GroupName+”.xlsx") using the BalaReva activity. This is where my issue occurs.
  10. After copying the correct header over, the bot writes the data table into the OutputFile and adds some unique formatting to the OutputFile (ex. different text sizes and fonts). I did not bother including this in the example I attached.
  11. The bot repeats steps 8-10 for each item in the VendorNumber Array.
  12. The bot moves onto the next Folder in GroupFoldersPath and then completes steps 3-11 until the bot has looped through all Folders.
  13. The job ends.

Any help is appreciated. Thank you!

@cfields

Welcome to the community

Can you say what do you mean by copy the headers ?

can you show or tell more detailed about what you are doing when you say that…so that we can provide an alternative…and did you explore the latest excel apckage it has more activities included if those might be of any help

cheers

1 Like

Sorry, I tried to attach an example workflow but it won’t fully load in. :frowning:

Many of the output files I am creating for each group require a unique header. There are about twenty headers to choose from. The headers are located in a “Header Template” Excel file. I have the bot copy the correct header from the “Header Template” file into the output file. I have explored the latest Excel package provided by UiPath and BalaReva Excel packages. The activity I am using now to copy the header is the BalaReva.Excel.Sheets.CopyToFile activity (BalaReva.Excel.Activities - #19 by balupad14). I am using the latest version of all packages (unless the latest version is a beta version).

I could solve this issue with VBA but I don’t have a lot of bandwidth to devote that sort of time to this project right now.

1 Like

@cfields

Multiple options and you can do one of these

you have a copy/paste range now in the official excel activities

image

if not use read range and then do a write range that also would do the same thing

Or as that is a template why not copy the template itself to use as a new file using a copy file activity

Or you can as well use copy sheet if you have all templates in same excel

image

cheers

1 Like

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