Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
How to copy to clipboard using JavaScript where the data will paste separately to each cell in google sheets

I thought by creating an HTML table format will paste to each cell but instead, it only pastes to one cell. for example

let copyTable = e => {
   e.clipboardData.setData('text/html', '<tr><td>Seperate</td><td>each</td><td>word</td></tr >')
   e.preventDefault()
}

Output

A B C
1 Seperateeachword
2

When I use the <br> instead I was able to have each word go to a separate cell

let copyTable = e => {
    e.clipboardData.setData('text/html', 'Seperate<br>each<br>word')
    e.preventDefault()
}

Output

A B C
1 Seperate
2 each
3 word

The only issue I am having now is how to paste data where it goes from A to C and so on instead of going from 1 to 3. I know I could paste special on google sheets and click transposed but I would like to eventually paste tables that can range from A1 to H10.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!