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

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.

Related

How do I import a Google sheet in a chrome extension project?

I wish to enhance an existing web page by adding statistics that can be regularly fed by a large amount of people.
I chose to use Google Sheets to retrieve the data so that anyone can access the tables and make their addition but I have no clue of how to display the sheet's results in the concerned web page.
In my case, I'm editing the webpage's text from Javascript.
I thougth of two tools that might help:
Importing the google sheet in Javascript (I can't find how to do that, an alternative would be welcome if not possible)
Importing the google sheet in Python and then exporting its results as an internal .txt file which I should be able to read with Javascript but that would require the .txt file to be updated every now and then.
Could you guys lend me a hand in how to do this?
Thanks in advance!

How to read excel file from user and generating Google Sheet file

I need to allow user upload excel (xlsx) file and then generate a Google Sheets file using Google Scripts (the generated file uses the input file values, process them with certain formulas and provides another excel file as output based on all processing)
I am currently doing the task in a simple desktop application (using MS Excel etc.), but problem is I have admin rights and I want other people to do the same on their PCs but they dont have admin rights, so please help me with this, whats the best way I can implement it via Google Sheets. I need following to do:
Get an XLSX file from user
Read two columns using google sheet script.
Process the read values and create a new google sheet file with 6/7 columns
Plz help as I am not looking for a ready made code but a head start, as I have never worked with google scripts before.
First you need to study the basics of Apps Script in general, and of the SpreadsheetApp, DriveApp and Advanced Drive Service in specific.
The steps to write your code would be
retrieving the excel file on your Google Drive
retrieving its blob
creating a new file of the mimeType GOOGLE_SHEETS with the contents of your blob
Once you create a Google Spreadsheet - process it with the SpreadsheetApp methods to delete spare contents/ create a copy with only the desired contents.
Here you can find useful samples.
Note: It might make sense to retrieve the columns of interest before
converting them to Google Sheets, but this is not something you can do
with Apps Script or a Google API since they do not have methods to
edit Excel files.

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.

Talend: use Google Spreadsheets as Input and Output

I'm using Talend for several ETL-jobs. Main focus on inserting and updating data defined in local Excel files to Salesforce. Excel and Salesforce are used as Input- and Output-Connections massively.
This works like a charm!
Now instead of Excel I need to use Google Spreadsheets as data inputs/outputs. Just manually download as Excel isn't good enough. Reason: I need a highspeed repeatable process executed thousands of times bi-directional. Uploading/Downloading XLS/CSV is not an option.
As an unfortunate, my researches concluded that there is NO Google spreadsheet connector available. I found this legacy-project which seems to be abandoned: https://code.google.com/p/google-talend-components/ - it is outdated from Talend-side as well as from Google (old API versions).
One other thing I've seen, is that Talend comes with Google Big Data Support: https://www.youtube.com/watch?v=BK6G3sTmwVE - Also Google Big Data might be somehow connectable to Google Spreadsheet - but I wasn't able to figure out how. Is this easy or hard? How to start? What to read?
I need to know if there is any viable approach to read and write data with Talend from and to Google-Spreadsheet.
Alternatively is there an other ETL-tool like Talend which has connectors to Google Spreadsheet AND Salesforce out-of-the-box?
Is there a direct google docs connector in Talend, no. But you can do what you are looking to do if you think of the problem a little differently. It sounds like you need to read and write to spreadsheets then upload/download from google. Lets take each problem separately.
Upload/Download
Google storage. If you need to upload and download files from google Talend has excellent integration with their API. As you mentioned, Talend --> Big Data has components to interact with Google Storage. This type of storage is primary meant as back end storage for an application.
In Talend under Cloud-->Google Drive there are components to upload and download from Google Drive. Google Drive is primarily meant as Chrome app and has direct integration with Google Docs.
Writing to Google Docs
Regarding your need to interact with google docs, you do not need any special components for this. Google docs can utilize csv and Excel formats. If you create and modify your documents in Talend using the standard file interaction components ( delimited, Excel, etc.) you can upload and download these documents using one of the two methods I described above (Google Storage or Drive) depending on what type of storage you are using.

uploaded and newly created Google Spreadsheets not indexed

Google drive does not always index files that are in google document format - specifically spreadsheets. Searching for a field in the spreadsheet works perfectly when excel spreadsheets are uploaded and not converted, but are not searchable when uploaded and converted to a google spreadsheet.
My testing within the Google Drive web application has shown that:
- searching for "UNIQUE1234" in the exact same document uploaded twice fails when the document is "converted" to google document format but succeeds with left unconverted (as an excel, .xlsx file).
- searching for the same string in a newly created spreadsheet (through the drive interface) also does not return the new document.
- these google document spreadsheets are at some point indexed as I can search some of my older documents.
The real problem is that I'm writing an application that uses the Drive SDK to search for a specific string within drive spreadsheets - and it doesn't work when the files aren't indexed. The only workaround I've seen is to have users not convert uploaded documents - but this isn't great as it is nice for them to occasionally alter uploaded fields.
My questions are: What triggers google drive to index Google documents? Is there a way to trigger indexing on a particular document? Is this a bug?
Any help is greatly appreciated as I'd like to autodetect spreadsheets with particular values in user's drive accounts.

Resources