SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Oct 2005
    Location
    Chennai
    Posts
    183
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Datatable.ImportSheet Failed.Invalid File

    Hi,

    I am have searched the forum and this issue has been asked many times.
    A good working excel sheet which was working earlier was updated with few rows of details. After modification, the sheet gets imported certain times and does not get imported for many other times.

    Code Used:
    strFilePath = "Path of File"
    strSheetName = "Business Flow"
    Call Sheet_ImportSheet (strFilePath, strSheetName)
    Function Sheet_ImportSheet (strFilePath, strSheetName)
    Datatable.Addsheet strSheetName
    Datatable.Importsheet strFilePath, strSheetName, strSheetName
    End Function

    Config Details:
    QTP 11
    Office 2002

    After adding row number 69 to 73 the sheet does not get imported. Is there any list of formats which is not accepted by QTP datatable? Please help immediately as stuck in this issue to meet the deadline..

  2. #2
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    U need to set the Row of the newly imported sheet as

    DataTable.GetSheet("Business Flow").SetCurrentRow = 73; just a fixed value for illustration
    Thanks,
    Ganesh Iyer
    Winds of Change

  3. #3
    Member
    Join Date
    Oct 2005
    Location
    Chennai
    Posts
    183
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    Hi MilesToGoBeforeISleep

    My problem is I am getting an error "Datatable.ImportSheet failed. Invalid file" while executing the line Datatable.Importsheet strFilePath, strSheetName, strSheetName.
    How can I perform Datatable.GetSheet when ImportSheet has failed.
    Can you kindly help me ?aq

  4. #4
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    Did u try the Import command instead of ImportSheet.
    Thanks,
    Ganesh Iyer
    Winds of Change

  5. #5
    Member
    Join Date
    Feb 2012
    Posts
    74
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    Check the file extension in file path.

    Do you mean it fails after adding 73 rows ??
    If you do find solution to a problem - have a bud & re-visit !

  6. #6
    Member
    Join Date
    Jun 2008
    Posts
    120
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    Hi ATE,
    I also faced the same issue with office2010 but saved the file as .xls,
    ---> I copied the content in the excel file to a new excel file(Copy the content not the remane the file).

    This will work fine....
    Thanks
    JC

  7. #7
    Member
    Join Date
    Oct 2005
    Location
    Chennai
    Posts
    183
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    Hi,

    I performed all the solutions which you had provided.

    MilesToGoBeforeISleep:-
    1. Even when I did Datatable.Import I get the same err msg "Datatable.ImportSheet Failed. Invalid File".

    KarthikPai:-
    1. I checked the file extension in the filepath variable, it is in .xls format.
    2. Yes, after adding lines from 69 to 73 I am unable to import the file.

    JCE:-
    1. I performed as you told me. I copied the contents into a new file and tried to Import the file (Datatable.Import).
    Even then, I get an error message "Datatable Import Sheet Failed. Imvalid File".

    Kindly help me...

  8. #8
    Member
    Join Date
    Oct 2005
    Location
    Chennai
    Posts
    183
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    Hi All,

    My issues had got resolved. I copied pasted the contents into a notepad file and again copied pasted the contents into a new excel file and GOSH it worked.

    Thanks for everybody who tried to help me out here.

  9. #9
    Super Member QAGanesh's Avatar
    Join Date
    Sep 2010
    Posts
    1,898
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Datatable.ImportSheet Failed.Invalid File

    It seems to be an issue with the excel file being formatted. May b u have used some formula's and formatting of cells in excel.
    Thanks,
    Ganesh Iyer
    Winds of Change

  10. #10
    New Member
    Join Date
    Jun 2013
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Unhappy Having same issue!

    Hi Guys,

    using QTP 11.
    Office: 2003 (saving files as XLS)

    We have recently started having the same problem.

    E.g. When we try to import the file (301 rows, 91 columns) it fails saying "invalid file".

    Some of the cells contain data with over 200 characters, but even after removing any cell with a character count > 200, the error persists.
    I have also tried the following:
    Running a clean on the cells, then copying the "cleaned" cells into notepad. Deleting the column in Excel, then pasting them back in.
    Removing ANY non numerical or text based character.
    Removing half the rows.

    The strangest part is, I can delete a row, one at a time until the error has been fixed. But then if I close down QTP, and re-run the data I get the same issue again.
    We have tried the above multiple times, and each time the cell which seems to be causing the error begins to work and a previously ok cell, starts causing errors.

    Currently if ALL of the text is removed from a specific column, it seems to work fine, but that is a critical data column that cannot be removed.

    Does anyone have any ideas on what may be worth trying next?

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:57 PM.

Copyright BetaSoft Inc.