Python Forum
How to copy data to clipboard
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to copy data to clipboard
#10
(Mar-05-2020, 09:14 PM)OAP Wrote: Let me try to clarify the process.
I understood the process perfectly fine from the first time. However your question is perfect example of so called XY problem.
The problem with your approach is you try to put a list of lists in the pyperclip. So you save to csv file, which you try to read into clipboard. Instead of writting to csv file, you can just create single string from the list of list and put that str into clipboard (achieving the same result what you will get by reading the csv in the clipboard).

Now, as we try to explain to you using clipboard is unnecessary complication.

Using your current code to read from DB which gives you list of lists, you can then use this list of lists to write directly to excel/calc file.
one library for working with ods files is pexcel-ods3: https://github.com/pyexcel/pyexcel-ods3
you can also use openpyxl to work with xslx file

you can also use pandas for reading from db and/or writing to excel/calc file
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
How to copy data to clipboard - by OAP - Mar-04-2020, 12:09 PM
RE: How to copy data to clipboard - by buran - Mar-04-2020, 12:59 PM
RE: How to copy data to clipboard - by OAP - Mar-04-2020, 04:10 PM
RE: How to copy data to clipboard - by ndc85430 - Mar-04-2020, 08:19 PM
RE: How to copy data to clipboard - by snippsat - Mar-04-2020, 09:08 PM
RE: How to copy data to clipboard - by OAP - Mar-05-2020, 03:52 PM
RE: How to copy data to clipboard - by buran - Mar-05-2020, 04:27 PM
RE: How to copy data to clipboard - by snippsat - Mar-05-2020, 08:33 PM
RE: How to copy data to clipboard - by OAP - Mar-05-2020, 09:14 PM
RE: How to copy data to clipboard - by buran - Mar-05-2020, 09:50 PM
RE: How to copy data to clipboard - by OAP - Mar-19-2020, 10:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 450 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon
  How to copy work sheet data one workbook to other? sayyedkamran 2 841 Nov-03-2023, 09:10 AM
Last Post: Larz60+
  non-latin characters in console from clipboard Johanson 3 861 Oct-26-2023, 10:10 PM
Last Post: deanhystad
  Copy data from Excel and paste into Discord (Midjourney) Joe_Wright 4 2,403 Jun-06-2023, 05:49 PM
Last Post: rajeshgk
  saving and loading text from the clipboard with python program MaartenRo 2 1,836 Jan-22-2022, 05:04 AM
Last Post: MaartenRo
  How to listen to clipboard content change without polling the clipboard continuously? edgelord 0 2,601 Nov-27-2020, 06:07 AM
Last Post: edgelord
  Problem posting image to clipboard noel 0 2,284 Sep-26-2020, 10:50 AM
Last Post: noel
  How can I copy and paste data from text file into an Excel sheet? IrishOrigi 14 7,618 Mar-19-2020, 07:25 PM
Last Post: Larz60+
  How can I paste an entire file from clipboard to a folder? daverave1212 5 9,097 Feb-08-2020, 04:33 PM
Last Post: snippsat
  Copy and append data from .dat file Makada 17 8,607 Jan-20-2020, 08:33 PM
Last Post: Makada

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020