Support > Forums > OpenBots Studio > Copy one Excel sheet into another Excel sheet

Copy one Excel sheet into another Excel sheet

Faheem Syed

  • Reporter
  • Calender Icon May 08,2024 at 2:55 PM

Dear Team,

I want to copy one Excel sheet into another excel sheet.

How can i achieve this using Excel Commands in Openbots?

This forum has 316 topics, 684 replies, and was last updated 2 hours ago by Support Agent

Support Agent

  • Participant
  • Calender Icon May 20,2024 at 6:36 PM

Hi Syed,

Thank you for reaching out. To address your concern, the current functionality of the 'Excel Copy Sheet' command in OpenBots does not require an additional field for specifying the new sheet name directly in the command. Here’s how it works:

  • Excel Instance Name: This is the source file from which the Excel sheet will be copied.
  • Worksheet Name: This specifies the sheet within the source file that you wish to copy.
  • Output Workbook File Path: This is the destination Excel file where the sheet will be copied to. The copied sheet will retain the same name as it has in the source Excel document.

If the sheet name needs to be changed in the destination Excel, the 'Excel Rename Sheet' command can be used afterwards. This additional step allows you to specify a new name for the copied sheet.

Regarding the error message you encountered (COMException, Invalid index), this typically indicates that the sheet you are trying to copy does not exist in the source workbook. Please double-check the sheet name in the source Excel file to ensure it is correct and that the sheet indeed exists.

Please verify your parameters on Excel Instance creation and ensure that all document paths and names are correct.

Let me know if adjusting these settings resolves the issue, or if there’s anything else I can assist with.

Best regards, Support Team

Faheem Syed

  • Participant
  • Calender Icon May 19,2024 at 7:20 AM

Dear Team,

In the Excel Copy Command, I could see only 3 Input Parameters

  1. Excel Instance Name
  2. Worksheet Name (The Sheet I want to Copy)
  3. Output Workbook file path. As you said Copy Worksheet: Use the 'Excel Copy Sheet' command. Specify the workbook instance of the source file and the name of the sheet you want to copy. Additionally, provide the workbook path for the destination file and the name you want for the new sheet. Here I'm specifying the
  4. workbook instance of the source file
  5. Name of the sheet I want to copy
  6. Additionally, provide the workbook path for the destination file Where can I Input the name, I want for the new sheet? Is Openbots missing something in the Excel Copy command ? I guess the Excel Copy command is not fully Implemented and without the New Sheet Name how does openbots understand the destination excel to copy the Source Excel Sheet. Whenever I tried to Ciopy a worksheet from one Excel to other with the existing command in Openbots I'm getting the below error Type: 'COMException', Message: 'Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))'] Please look into this as soon as possible and resolve the issue.

Regards, Syed Faheem

Support Agent

  • Participant
  • Calender Icon May 17,2024 at 8:04 PM

Hi syed. faheem,

Thank you for reaching out with your query. To copy a sheet from one Excel file to another using OpenBots, you can follow these steps:

Open Excel Files: Use the 'Excel Create Application' command to open the source Excel file. Copy Worksheet: Use the 'Excel Copy Sheet' command. Specify the workbook instance of the source file and the name of the sheet you want to copy. Additionally, provide the workbook path for the destination file and the name you want for the new sheet. This command will copy the sheet from the source workbook to the destination workbook. Save and Close: Use the 'Excel Save Workbook' command to save the changes in the destination workbook if needed. Finally, use the 'Excel Close Application' command to close open instances.

If you have any further questions or need additional assistance, please don't hesitate to reach out.

Best regards, Support Team

You are not authorized to reply, please click here to login and add your reply to this topic.