Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Datatable import error
#1
Not Solved
Hi All,

I have a problem in importing an excel file into datatable.
code:
Code:
datatable.addsheet("Login")
datatable.ImportSheet "D:\FolderName\SubFolderName\InputFile.xls","Login","Login"

is throwing Run Error "The DataTable.ImportSheet operation failed. Invalid file"
Same code till yesterday worked perfectly fine.

When the same script is run in the morning it is throwing the above error. No changes have been made to the file format, only data is changed. it is .xls file only.

I thought the problem is from QTP side,some datatable dll might have got corrupted, and installed QTP11 on another system, the problem persists in other system also.

Please let me know the solution, other wise ill have to modify nearly 20 scripts.
Reply
#2
Not Solved
Please see if you are able to import the sheet by right click on dataTable's top left hand corner cell and then choose file-->Import from file.If successful, export the same sheet and try the code.
Reply
#3
Not Solved
I tried Importing file by right clicking datatable but, it says "Invalid File".

I see one more thing, when i open my script in QTP by default without running the script i can see the data's filled in datatable, which are old. Y is this happening.
Reply
#4
Not Solved
Try importing some other sheet and see if same thing happens. If not your file is corrupted.
for the second query, it looks like you have already mapped a spread sheet.Go to file->Settings--Resources. Un map the file in data table section "other location"
Reply
#5
Not Solved
I tried doing it with other excel. On right clicking on datatable and importing file works fine, i mean it imported the file.
but same file when tired to import writing the code again says same "cannot import file not found .........."

And for the second query, i checked file->Settings--Resources--"other location" is absolutely empty nothing is selected.

The file when clicked is opening properly ,, In case if the file was corrupted,, i would hav not been able to open the file manually also.

Are there any chances of working fine if i uninstall excel and install it again.
Reply
#6
Not Solved
It shouldn't be a problem with excel installation as you are able to import the other file.It should be .xls file(97-2003 format).Hope you are using the right format.Copy the data to the file which you were able to import , then export this sheet using file->export (same option from where you have imported) and try your code.It should work.
Reply
#7
Not Solved
The format is right. As a solution i tried copying the file into new file, and changed the name of the file in the script.
Some where in between the old excel file got imported without any issues. And the new excel file also showed the message once "Invaild file......................." Am Very confused!!!!
Reply
#8
Not Solved

GO to Tools--> Options --> click on 'Restore factory Defaults'.
Tool gets restarted and you wont face the issue again.

Thanks,
Praveen
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error as Global Not defined while trying to retrieve value from Datatable siddharth1609 0 839 09-11-2019, 02:52 PM
Last Post: siddharth1609
  Datatable.importsheet error niks19 2 3,225 08-21-2015, 12:00 AM
Last Post: ADITI1992
  How to import .xlsx file type to QTP qtped 3 6,307 03-27-2014, 01:33 PM
Last Post: Ankur
  Import multiple values from excel into QTP Shaik Ahmed 2 3,248 03-09-2014, 09:17 PM
Last Post: Shaik Ahmed
  Import and read multiple tabs on a datasheet trance07 1 3,083 10-09-2013, 07:29 PM
Last Post: Parke

Forum Jump:


Users browsing this thread: 1 Guest(s)