SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    QTP: How do I rename the spread sheet

    When I use below code, it renames the first spread sheet to Globle and second one to Action1. How do i rename Globle sheet to Location.

    datatable.Import "C:\Temp\Test.xls"
    rec_count=datatable.GetRowCount
    For i = 1 to rec_count
    datatable("Effective_Date",1)=date()
    datatable.SetNextRow
    Next
    datatable.Export "C:\Temp\Test.xls"

    Thanks,
    Prashant Patel
    Thanks,
    Prashant Patel

  2. #2
    Member
    Join Date
    May 2005
    Location
    Noida
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    hI,

    You can use DATATABLE.IMPORTSHEET funtion while importing it.

    Then it will not change the name of the sheet.

    Thanks

  3. #3
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    Hello Navneet,

    DataTable.ImportSheet "C:\Temp\Test.xls",1,"Global"
    rec_count=datatable.GetRowCount
    For i = 1 to rec_count
    datatable("Effective_Date",1)=date()
    datatable.SetNextRow
    Next
    datatable.Export "C:\Temp\Test.xls"

    Is this the right code I am using it because it still changes the Sheet Name to Global.

    Thanks,
    Prashant Patel
    Thanks,
    Prashant Patel

  4. #4
    Member
    Join Date
    May 2005
    Location
    Noida
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    Change the "global" to the sheet name and ensure that the name of the data sheet in the Excel file is what you want to be.

    Thanks

  5. #5
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    I am still confused. Please bear with me as I am trying to understand. I have Excel file called "Test.xls" and it has spreadsheet name called "Location", and run-time Data Table has spreadsheet name called “Global”.

    Do you want me change the run-time Data Table spreadsheet “Global” to “Location”? If yes please how do I do that?
    Thanks,
    Prashant Patel

  6. #6
    Junior Member
    Join Date
    Oct 2002
    Location
    BJ
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    datatable.ImportSheet "f:\test.xls","Location","RunTime_Location"
    provide free download to you.
    please email to me.
    zlhome@yahoo.com

  7. #7
    Junior Member
    Join Date
    Oct 2002
    Location
    BJ
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    oh,sorry,you must insert the following code to add a new sheet.

    datatable.AddSheet("RunTime_Location")
    'and then
    datatable.ImportSheet "f:\test.xls","Location","RunTime_Location"


    rec_count=datatable.GetSheet("RunTime_Location").G etRowCount

    For i = 1 to rec_count
    datatable("Effective_Date",1)=date() '??what mean?
    datatable.getsheet("RunTime_Location")
    datatable.setcurrentrow(i)
    Next
    datatable.Export "C:\Temp\Test.xls"
    provide free download to you.
    please email to me.
    zlhome@yahoo.com

  8. #8
    Member
    Join Date
    May 2005
    Location
    Noida
    Posts
    131
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    Hi Prashant,

    Hope the solution given by folusu works for you.

    Thanks

  9. #9
    Member
    Join Date
    Jun 2005
    Location
    Hyderabad
    Posts
    56
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    Hi ppat7046,

    If i understood your requirement, you have an excelsheet which is named as 'Location' and when you import this you want it to be "location' in global runtime datatable , right?

    If yes
    datatable.importsheet "filename", "source sheet", "destination sheet"
    here source file is "location" (from your external excelfile"
    Destinatin sheet is 'Global"

    So try in the following way,
    Datatable.importsheet "give the filename", "Location", "Global"

    Hope it solves your problem,

    Folusu, i think when we use importsheet command we need to use exportsheet but not as Export?
    Regards,
    Neethu.

  10. #10
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP: How do I rename the spread sheet

    I think I am confusing myself more. Here what I need to do.
    I have a Excel file called Text.xls.
    Excel file has Spread Sheet called Location.
    Under Spread Sheet I have following Data.
    ColumnA____________ColumnB
    London-------------I need to put todays date here.
    Bombay-------------I need to put todays date here.
    USA-------------- I need to put todays date here.

    After I put the Todays date, I need to save the Excel File Text.xls with the Same Spread Sheet name called Location.

    Thank you for being patient with me.
    Prashant Patel
    Thanks,
    Prashant Patel

 

 
Page 1 of 2 12 LastLast

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 10.71%
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:41 AM.

Copyright BetaSoft Inc.