View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Export multiple datatables from a C# form to Multiple Excel sheets

I don't know #C syntax but it will be something like this

1) You can create a list of worksheet names in an array

char SheetNames[] = {"Sheet1","Sheet2"}

then reference the sheets from an arrray

2) Get every worksheet from the workbook

Sheets = Myworkbook.Sheets.Count
for SheetCount = 1 to Sheets {
data= MyWorkbook.Sheets(SheetCount).Range("A1")
}


I haven't used C Language in a while so I'm a little bit rusty. But I think
you can figure out the rest. From excel you should be able to get a count of
the worksheets in a workbook and then reference the sheets by number.
"TRBG" wrote:

How do I export multiple datatables from a C# form to Multiple Excel sheets
using a datagrid with htmlwriter so it is simple, fast and efficient but can
do it to mulitple worksheets. right now that method export html but all on
one spreadsheet

Thanks,
--
TRBG