Google Docs Publish to the Web Data parsing - parsing

I have a trouble with parsing of data from google spreadsheet api. I have a spreadsheet with 3 pages and I need to get data from there and parse them to array where key is cell position and value is value of cell.
When I go to File->Publish to the web with option "All sheets" and target format is CSV seperated with comas I get a link which is targeting data with just values of cells and just from first page.
Here is any way how to get data from all sheets and with information where are placed in document (cell name (code))?
Thank you all!

You can use Google Spreadsheet API, for example using its Java Library
or you can use Google Apps Script and its spreadsheet methods
both of them are giving you the ability to have your data live in Google spreadsheet and at the same time access it from other clients or sites. You don't need to export it and lose the ability to have it updated across all your clients.

Related

Is it possible to generate a google sheets document with graphs programmatically as a file?

I have an application that runs benchmarks and generates a CSV file with the report contents.
To interpret this report, I have created a template GSheets document with queries, drop down selections, graphs, etc.
Consumers must:
Run the benchmarking tool to generate the data CSV
Go to the template document in gsheets (outlined in the readme)
Copy the template into their own gdrive account
Insert the contents of the CSV into the unprotected data sheet of that document
This is a lot of manual handling and I would rather be able to, like a csv, programmatically produce a file that contains the filled out sheet where the consumer just needs to open the sheet with the Google Sheets account.
From what I can see, Google Sheets doesn't have a specific file format that it uses and the gsheet files are just empty magic links that the web app knows to respond to.
I can imagine that I can use the Google Sheets web API to publish a new file to the user's Google Drive but I don't want to mess around with Google OAuth authentication as I feel that's overkill.
Is it possible to write a file that Google Sheets can interpret directly?
Perhaps I can write an older MS Office .xls file and Google Sheets can interpret it via the import functionality?
My backup is writing the report to an html file with a web app that visualizes the data using some charting JS library - though it would be a shame because everything I need is already in Google Sheets.
Google sheets have an API: gspread.
If it's only a matter of switching data, you could create main spreadsheet with graphs etc. set up, and then using an API copy it and paste new data into it.

Extract data from Google docs to Google sheets

I am working within the same Google drive folder.
I have a number of Google Docs, which all contains a number of tables in the same format. What I want is to export the data from each table in to according rows in a google spreadsheet. I think the function should be automated to run ones every day. The first problem I am bumping in on is to open the different Doc files and extract the tables - any surgestions on how to do that?
The folder is access protected, but both the Docs and Sheet are placed within the same folder.
BR.
Torben
You will need to use the Drive API and export the documents as HTML. Then you will need to parse the HTML yourself to extract the table data. Finally use the Sheets API to insert that data into your spreadsheet.

How can I make and connect a spreadsheet to my code using the Google Sheets API?

I'm writing an app that needs to record data in a Google Spreadsheet with Swift.
I'm just really uncertain how to actually get started! I set up the Google sheets API in the Google API console and in my cocoapods following the Quickstart provided by google. Google's libraries GoogleAPIClientForREST and GTMOAuth2 are in my app and are ready to be used.
I basically just need to read and write to an existing spreadsheet but I do not know how to create the spreadsheet and refer to it so I can read and write to it as needed.
Thanks!
Whenever I want to read or write to a Google spreadsheet using the Sheets API, I refer to Reading & Writing Cell Values.
Basic Reading
The following spreadsheets.values.get request reads the values stored in the range Sheet1!A1:D5 and returns them in the response. Empty trailing rows and columns are omitted.
GET https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!A1:D5
Basic Writing
Starting with a new, blank spreadsheet, the following spreadsheets.values.update request will write the values to the range Sheet1!A1:D5. The ValueInputOption query parameter is required and determines if the values written will be parsed (for example, whether or not a string is converted into a date).
PUT https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId/values/Sheet1!A1:D5?valueInputOption=USER_ENTERED
Here's the iOS Swift Quickstart for your code reference.

How to produce a print-ready report based on Google Spreadsheet

I have a Google Spreadsheet which stores data filtered from another Spreadsheet which in turn is a sorage of Google Froms questionnaire.
I'd like to produce a print-ready report on a filtered data, retreiving certain data columns and laying it out with some titles, decorations etc.
How can I produce such a report using Google tools?
In this article it explains pretty well how to: Google Apps Script to create PDF.
It made a predefined template of a Google Docs, copyed it and replaced predefined places with the info in the current line of the Spreadsheet, then convert to PDF. If you don't have a predefined length of elements, you can append new info on the documents with the body element.
Take a look at the AutoCrat add-on or Yet Another Mail Merge add-on.

Using Google Spreadsheet as DB for apps

I want to use Google spreadsheets to store data online so multiple people can enter and maintain data, then publish or export (csv, xls, ods) the sheet for their application. What is the easiest way to process the sheet? If the data can be accessed as a link the updates could be immediately reflected in the client's app.
This article Data Scraping Wikipedia with Google Spreadsheets discusses using Google spreadsheets as an application platform.
It already has features that allow you to share the spreadsheet with multiple editors, as well as the ability to define forms that you can invite people to fill out who's results will be entered into the spreadsheet as a row.
Just in case its still vaguely of interest 5 months later, there is a SQL-like wrapper language for Google Spreadsheets at:
http://gqlx.twyst.co.za
Its very much an alpha release - but maybe its of some use or perhaps the code could give you some ideas.
I think if I am clear on your requirements, you want to store your data online in a Google Spreadsheet where multiple people can access that right? Then you want an app to use that data? Correct me if I am wrong.
It is possible to have Google spreadsheet as a database and the client app can directly access that data through APIs - spreadsheet APIs . If you want a simple link where people can go and update - you can also have a web app using google apps scripting. very simple to use and would solve your purpose too , why to export your data to ods, xls, csv, make your app directly over Google Spreadsheet. Would be maintainable too.

Resources