Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
importing excel data
#1
Solved: 11 Years, 4 Months ago
Hi All,

I tried importing excel data through this process but I received the following error during run-time:
Code:
"The Data Table.AddSheet operation failed. Invalid argument".
sheetcount = DataTable.GetSheetCount
If sheetcount < 2000 Then
Line (3) datatable.AddSheet(SheetName)
            datatable.ImportSheet Dir&ExcelName,SheetName,SheetName
            DataTable.SetCurrentRow(0)            
End If

The error shows up in line (3) datatable.AddSheet, stop and re-running the script from beginning solve this problem, is there any why to avoid this error.
Reply
#2
Solved: 11 Years, 4 Months ago
Hi Galis,

First use DataTable.AddSheet("sheetName") and then use DataTable.ImportSheet.
Reply
#3
Solved: 11 Years, 4 Months ago
Hi manishbhalshankar,

o.k, I am using the add sheet before the importsheet but still I received an error.
Line (1) sheetcount = DataTable.GetSheetCount
Line(2) If sheetcount < 2000 Then
Line (3) datatable.AddSheet(SheetName)
Line (4) datatable.ImportSheet Dir&ExcelName,SheetName,SheetName
Line (5) DataTable.SetCurrentRow(0)
End If


Thanks
Gali
Reply
#4
Solved: 11 Years, 4 Months ago
Hi,

On line (4), you have "Dir&ExcelName".
Does it mean that there are 2 variables where Dir has the location of the file and ExcelName has the file name?
If so try this:
Code:
Dir = "Complete path of your file\"
ExcelName = "ExcelName.xls"

DataTable.AddSheet("TestSheet")
DataTable.ImportSheet Dir & ExcelName, "sheetName", "TestSheet"

This is working for me.
Reply
#5
Solved: 11 Years, 4 Months ago
Hi manishbhalshankar,
o.k
Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)