Datatable import error - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Datatable import error (/Thread-Datatable-import-error) |
Datatable import error - Prashanth - 04-05-2013 Hi All, I have a problem in importing an excel file into datatable. code: Code: datatable.addsheet("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. RE: Datatable import error - ravi.gajul - 04-06-2013 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. RE: Datatable import error - Prashanth - 04-08-2013 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. RE: Datatable import error - ravi.gajul - 04-08-2013 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" RE: Datatable import error - Prashanth - 04-08-2013 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. RE: Datatable import error - ravi.gajul - 04-08-2013 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. RE: Datatable import error - Prashanth - 04-08-2013 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!!!! RE: Datatable import error - praveen.g3 - 11-19-2014 GO to Tools--> Options --> click on 'Restore factory Defaults'. Tool gets restarted and you wont face the issue again. Thanks, Praveen |