Re: [Sikuli-driver] [Question #187149]: How to write in existing Excel Sheet
Question #187149 on SikuliX changed: https://answers.launchpad.net/sikuli/+question/187149 hcuthbert posted a new comment: Example 1 -- workbook is already created, column has been added to the worksheet where cell data is added.Data has been added to the clipboard (Ctrl &C -- copy) def CB_Write(): #The function which is used to copy from the clipboard Env.getClipboard() #create a variable to use for the clipboard item cb = Env.getClipboard() #open the workbook rb = xlrd.open_workbook(""C:\\SikuliX\\\\Sample.xls") #copy the workbook to make it writeable wb = copy(rb) #write to the sheet and column #first number represents the row #second number represents the column #cb -- represent the write info from the clipboard sheet = wb.get_sheet(2).write(1,0,cb) #save the workbook wb.save("C:\\SikuliX\\\\Sample.xls") CB_Write() -- Example2 -- this example overlays the workbook def ExcWr(): #The function which is used to copy from the clipboard Env.getClipboard() #create a variable to use for the clipboard item and any other data needed cb = Env.getClipboard() cb1 = "Easy" cb2 = "Peasy2" #open the workbook rb = xlrd.open_workbook("C:\\SikuliX\\...\\SikuliWrite.xls") #copy the workbook to make it writeable wb = copy(rb) #specify the correct encoding of the workbook book = xlwt.Workbook(encoding="utf-8") #specify the sheetname sheet1 = book.add_sheet("MySheet1") #write the column names #0,0 = A1 #0,1 = A2 #0,2 = A3 sheet1.write(0, 0, "Test1") sheet1.write(0, 1, "Test2") sheet1.write(0, 2, "Test3") #write the row data #1,0 = B1 #1,1 = B2 #1,2 = B3 sheet1.write(1, 0, cb) sheet1.write(1, 1, cb1) sheet1.write(1, 2, cb2) book.save("C:\\SikuliX\\...\\SikuliWrite.xls") ExcWr() hope this helps those out there trying to write to Excel -- You received this question notification because your team Sikuli Drivers is an answer contact for SikuliX. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #187149]: How to write in existing Excel Sheet
Question #187149 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/187149 RaiMan posted a new comment: Good finding: http://pypi.python.org/pypi/xlutils So with xlrd (read Excel sheets), xlwt (create new Excel files) and xlutils we have all we need for working with Excel content directly from Sikuli. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #187149]: How to write in existing Excel Sheet
Question #187149 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/187149 Status: Answered => Solved Prateek Sahu confirmed that the question is solved: I found a solution for my problem Raiman, I am able to write in a existing Excel sheet using xlutils -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #187149]: How to write in existing Excel Sheet
Question #187149 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/187149 RaiMan posted a new comment: UUUps, why didn't you subscribe to the question? -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #187149]: How to write in existing Excel Sheet
Question #187149 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/187149 Status: Open => Answered RaiMan proposed the following answer: basic info see comment #1 at question https://answers.launchpad.net/sikuli/+question/187101 Writing in an existing excel sheet is not possible the easy way. All the above solutions generate new sheets/files, that have to be merged into the existing sheet afterwards using standard Excel features (which might be controlled with Sikuli GUI manipulations). You might try to GUI-control an the Excel app and write directly into an existing sheet using paste(), but this might be a gigantic effort not really worth to spend. I am not an expert, but Office Basic might have interesting features, that might be used and controlled by Sikuli. Many options, but if I had to do it, I would create a csv file and merge it into the existing Excel sheet afterwards. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp