Nayir Nolamaz
Nayir Nolamaz

Reputation: 79

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>   

Upvotes: 1

Views: 3985

Answers (2)

namzaG
namzaG

Reputation: 582

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')

Upvotes: 2

Mr.Rebot
Mr.Rebot

Reputation: 6791

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.

Upvotes: 1

Related Questions