Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
saving same datatable modified by diff sources
#1
Not Solved
Hi ,
i am facing an issue in saving to an common xls from diff scripts running from diff machines populating different columns & rows.
The data which persist is from the last run script( Previous script data is lost).Methods used are datatable.import and export.

Pls let me know how can i persist the old data even.

Thanks.
Reply
#2
Not Solved
Can anybody help out with this please?
Reply
#3
Not Solved
Dear Pradeep,
Are you exporting global and local sheet ?
Can you post your import or export code here...

If you are exporting Global and Local then it is going to update..

I can help you if you post your code here.
Reply
#4
Not Solved
thanks Sridhar, its a global sheet i will be exporting code is usval one

datatable.Import("C:\Test_Data.xls")
* some cals here
datatable.Value("Test_PL_value")=Plval
datatable.export("C:\Test_Data.xls")

but this code is also run in another machine ( diff environment) and update the same datatable. The result i am seeing is the latest update but what i need is both saves done on diff environments (offcourse to diff columns).

-Pradeep
Reply
#5
Not Solved
Dear Pradeep,
Export method exports both global and local sheet.
clear me one thing .Where is the output is it in Global sheet or Local sheet.
If it is in only either local ot global sheet then you use the Import or Export sheet method then it is going to workout for you..
Reply
#6
Not Solved
Hi Sridhar,
Its in the Global sheet.

The whole process is
1.2 scripts picks up(import) the xls file
2.Updates it
3.stores it at the different time(exports to the same loc and same file name).

the script which stores the datatable at the later time is actually replacing the old xls file . This is the pronblem .

what i need is something wherein the xls gets updated with preserving the existing data in it.

The approach i think is to read the xls first before saving any update and write to it with pervious data (which is read) with the new data.

pls suggest as i feel this is bit complicated approach.


Thanks,
Pradeep
Reply
#7
Not Solved
U need to append the exls file instead of writing it again
Below code might help u:

Code:
Dim fso
Set fso=CreateObject("Excel.Application")
fso.visible=true
Set excel_obj=fso.workbooks.open("D:\BookingResults\test1.xls")
Set obj_worksheet=excel_obj.worksheets(1)
cell_address=obj_worksheet.UsedRange.Address
add_array=split(cell_address,"$",-1,0)
row=add_array(2)+1
col=add_array(1)
obj_worksheet.cells(row,col).activate
obj_worksheet.cells(row,col).value="Hi"

Correct me if wrong
Regards,
Sankalp
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to find the latest modified file in QC11 current test attachment using QTP10 shiv.cse 0 1,865 07-23-2013, 01:25 AM
Last Post: shiv.cse
  QTP is throwing session error after saving the page but manually not in AJAX and JSF sking511 2 3,326 07-22-2010, 04:33 AM
Last Post: sking511
  what is diff between session id and GUI, ROCS number sunny rao 0 1,489 01-15-2009, 08:04 PM
Last Post: sunny rao

Forum Jump:


Users browsing this thread: 1 Guest(s)