Download excel with multiple sheet
Question

I am using Worksheet_SelectByIndex() excel function to create more than one sheet for same worksheet file.

I am using same function for 2 sheets with worksheetnumber = 1 and 2 respectively for same excel book.

But at the time of second sheet it throws an error

"Index value not exist in the dictionary".


Are you using any components to do this?

There are several Excel extensions. The top 3 are:

  • Advanced Excel
  • Excel Package
  • Office Utils

I would try to use Advanced Excel.


Cheers,
Nuno Verdasca

mvp_badge
MVP

Hi,

Are you using the Advanced Excel component? It's easier to get support if you start a topic in the Support tab, as all creators are notified:


Reading the documentation, you should be invoking the Workbook_AddSheet action before calling Worksheet_SelectByIndex - have you tried it?

I am using Excel_package into it I am using 

workbookCreate()

selectWotksheet() - here I am assigning worksheet number as 1 for 1st sheet

for second sheet I am assigning worksheetNumber 2

it throws an exception as

“given key not present in the dictionary”


This happens because in the WorkbookCreate () you must define the number of sheets that your excel file will contain, surely you are creating more sheets than you defined.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.