简体   繁体   中英

Put html table data in google spreadsheet

Hey guy's I am trying to send table information to google spreadsheet.

I have tried:

This worked (but i need table data instead of input)

Is there a way to fix it without using google-script. just pure javascript ?

<table>
  <tr>
    <th>Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  <tr>
    <td>John</td>
    <td>Wick</td>
    <td>33</td>
  </tr>
  <tr>
    <td>Jeff</td>
    <td>AndersOn</td>
    <td>94</td>
  </tr>
  <tr>
    <td>John</td>
    <td>Doe</td>
    <td>33</td>
  </tr>
</table>


    <button type="submit" onclick="test()" >Verzenden</button>   

First you have to put the tables in array like this

After that you have to make 2 functions 1 that creates an spreadsheet and 1 that writes the value in it.

You can find many information at the link that MR.Rebot shared

I used this (after putting

var params = {
    "range":"Sheet!A1",
    "majorDimension": "ROWS",
    "values": [],   
}
('POST', 'https://sheets.googleapis.com/v4/spreadsheets/'+SheetID+':batchUpdate')

Try using Sheets API:

The Google Sheets API lets you read and modify any aspect of a spreadsheet. Spreadsheets have many settings that let you craft beautiful and functional sheets, so the API has many settings too. The API offers two main ways to interact with the spreadsheet:

There is a JavaScript Quickstart that makes requests to the Google Sheets API. You can use this to familiarize yourself with the functions and code implementation.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM