Is there a way to visualize Chart by its spec obtained from Sheets API using Node.js? - node.js

I use Google Sheets API from googleapis to get a spreadsheet and its charts. So I have ChartSpec. How can be this spec used to visualize the chart in a web application, e.g. using Visualization API?
Use case
A simple web app written in HTML and JS which shows all charts from an arbitrary spreadsheet. In the ideal scenario, the charts are rendered just like in spreadsheets, so I can see the charts without the necessity to open a spreadsheet manually.
A user selects a spreadsheet from a list of predefined spreadsheets (menu)
Web app requests up-to-date data for the selected spreadsheet from Node.js backend
Node.js app gets all charts in the spreadsheet using Google Sheets API
Node.js app responds with necessary data
Web app visualizes the charts that should ideally be interactive (eg. using Visualization API)
Problem
I have a trouble with steps 4 and 5. In step 3 I receive ChartSpec which seems to contain all information but data. Instead of data, there are just references to ranges in a form of ChartData object.
Creating a custom implementation which gets all referenced data seems extremely complicated. Even if I created it on my own, I do not know how to create visualizations in step 5.
What I found and why it is not solution for me? There are similar questions and solutions that use Visualization API to query data from a spreadsheet and the visualize it, such as this answer. Why is this not solution for me? Because my spreadsheets are created by non-tech people who do not follow any good practices, so data cannot be easily queried using Query API. The spreadsheets are a mess. The charts are created by the same folks and they want to customize it by themselves. What I need is to show already existing charts without necessity to make any chart-wise code.

The only solution I came up with so far is to use the Chart Editor and allow the user to set up the chart himself. I would be interested in investing in such a solution or working on it together.

Related

Excel Mobile Data Entry Form

I am trying to create a data entry "app" to collect daily readings across our site. Here are the three biggest constraints:
Software - ideally, we would use some software within the Microsoft 365 Suite, mainly because those are the only approved apps on site. It may be possible to use open source software, but that might raise some flags in terms of security. So my thoughts are to use either Excel or Access.
Cost - ideally, we do not want purchase any additional software licenses. I would try and create something with Power Apps, but we do not have the licensing for an Azure or SQL server to store the data. I could be missing something here though.
Mobile-Friendly - finally, it needs to work on an Android tablet. Currently, we collect readings using pen and paper. The whole idea of this is to move towards using a tablet.
The easiest approach would be to create an Excel spreadsheet, save it on OneDrive, and edit the spreadsheet. I don't love this option because we are collecting 100's of data points each day. This would end up with a very wide spreadsheet that will be cumbersome to navigate.
The other option I looked into was creating an Access database and accompanying form and storing it on SharePoint. However, it seems Microsoft has stopped supporting Access databases on SharePoint.
I have created data entry forms using VBA, similar to this, but these do not work on mobile.
Is it possible to create a data entry form in Excel that also works on the Android version of Excel? Are there other alternatives I am not thinking of?
I am engaged in just this kind of project also. I have written an app in PowerApps, built an Excel spreadsheet and stored it in OneDrive, and am running it (the app) on an iPad. The design differs somewhat from your description of directly presenting a spreadsheet to the user (which I think PowerApps could do) because I don't want users having direct access to the data.
Edit: You do not need Azure or SQL, unless you are storing tons of data. Excel can be a satisfactory data storage location for modest uses.
I found the learning curve for PowerApps to be quite steep, as it's a different paradigm than line-by-line coding.
I think this is a more user friendly way to collect data than trying to run an Excel form, and once you get it made and polished, you'll look like a pro :)
I am by no means an expert but if you need some tips I'll do what I can to help. It sounds like we are at similar developmental stages.
Is it possible to create a data entry form in Excel that also works on the Android version of Excel? Are there other alternatives I am not thinking of?
Microsoft Forms does the job when created from OneDrive on mobile browser. Side note: the form I just created and the response I submitted have now disappeared from my OneDrive.
I also saw some people using Power Automate to save responses from a form into an Excel file (every reponse).

Effective way to interpret data from Excel Export

My business works with a partner business. The partner business has a database we can access using web forms. We have to do hourly/daily metric reports which involves exporting the data & copy/pasting into a google sheet which then gets us our numbers.
My question is, is there a more efficient way of grabbing this data if backend access to the database has been rejected. Ideally I'd like to do my own queries but since I have no access I run the query on the webpage, export to excel, then copy paste the data into a google sheet and then use the query function to get what I need. What would be the solutions you would advise? Should I ask for a web service? Any way to automate exports? Any ideas?
What you are doing appears to be web-scraping. If so, you can scrape HTML tables from a website from within a Google sheet. Absolutely no backend access using the IMPORTHTML function.
See this excellent video: https://www.youtube.com/watch?v=95c0OlsjKgU

Google Charts Data security

We are considering using Google charts for our project but we have highly confidential data. Can you use Google Charts without sending the data to Google?
Also, can we run this as a server charting tool also?
You may want to read Google Chart's section on security: https://google-developers.appspot.com/chart/interactive/docs/security_privacy
Specifically:
Google also does not keep the private data stored in a chart: charts where data is uploaded to Google servers is only done so for the purpose of rendering the charts for you. chart data uploaded to Google servers is maintained a short while for debugging purposes, and then discarded.
And
All Google-authored charts are developed with privacy and security considerations in mind. All Google chart documentation pages include a data policy section that describes whether a chart sends any chart data from the page.
EDIT: Like the quote above says, the data policy for each chart is contained in the documentation for that individual chart. For example: https://google-developers.appspot.com/chart/interactive/docs/gallery/areachart#Data_Policy

Running Excel automation locally or on server

Wanted some opinions on which method is a better practice. We have a sales report that MUST be generated in a very specific format (down to the row colors and fonts).
I already have written a macro which pulls from our database and populates the entire workbook in about 15 seconds. The question is how should it be populated?
1) Process server-side: Users initiate the request on the intranet page. ASP.NET opens the workbook template, executes the macro and serves back the final sheet.
2) Process locally: Users download the blank template, run from their desktops which automatically connect to the database.
I like the first one because I can enforce the template, timing, users, and security of the data. But is running Excel automation on an internet web server recommended? I like the second option, but I'm afraid of losing standardization as template sheets begin floating around the company.
As for server side:
I highly.. HIGHLY.. recommend checking out the OpenOffice/LibreOffice XML format for spread sheets.
You can use the localc binary in headless mode to convert the XML file to XLSX or what have you. I use it to create PDF files instead of using ReportLab.
Alternatively here are some other projects that attempt to write to Microsoft formats directly:
http://pypi.python.org/pypi/xlrd
http://pypi.python.org/pypi/xlwt
As for client side:
If you expect the user to be only using Excel and not any other spreadsheet software then go ahead and use an ODBC data source. ODBC will have to be configured per user unless you use some fun VBScript to pull the data from an HTTP server every time it is loaded. There is also the option of making an XLS spreadsheet that simply holds the data and including it into an XLS document as well which would be both a server and client XLS requirement.
Go for server side. Makes information simple to archive and share and will most likely be multi-platform as well.
If you like to use your first option, then you want to avoid using VBA on an installed instance of Excel on the server. This is extremely resource intensive and does not scale well. Instead, if you are writing ASP.NET code, then you should try using the Microsoft Office Interop functionality that is built into the .NET framework. It should possible to adapt your existing VBA code to run under ASP.NET with some changes, but you will have a much more reliable product in the end.
Example Code
However, as #whardier points out in his response, if this were for a large scale or public site, the suggestions he makes would be much more suitable and would scale much further.

Use Excel for calculations in web app

I've inherited a large Excel spreadsheet that does some financial calculation magic using any number of simulation tables, and have been asked to write a web application as a front end. Now I could spend endless hours trying to figure out the sheet, or I could call the excel sheet from my web app. I seem to need the Office Primary Interop Assemblies, but do I also need to install office/excel on the web server? How can I handle multiple simultaneous requests to the same sheet? Is this approach even possible?
We have implement a project where we call several Excel spreadsheets from a web app.
We use Sharepoint Excel Services to do this. It has worked very well for us.
In our case our largest spreadsheet has over 300 input parameters, 1000 formuals and 50 results. This takes about 0.5 seconds, where most of that time is moving data in and out of excel services via a web service.
The main draw back in using Sharepoint Excel Services is the cost. However, in our case the saving in development time far out weighed the cost.
Excel is a desktop Application (and a very good one) and not designed for either multiple users or deployment in a web application. You might be able to cobble something together but you are likely to have to write a lot of code to manage the design features of a desktop app which are inadequacies in a web app.
You are better off trying to understand what the Excel workbook is doing and simulating it in code with the desired multi-user features in mind which must have been beneath the request for a web app. If you have access to the current users and/or author you should be able to document the requirement and you have the Excel workbook for you to test your algorithm against once you have understood it.
Best of luck.
Take a look at SpreadsheetGear. Ordinarily it is used to generate new spreadsheets, but it has a calculation engine for existing spreadsheets too. And unlike Excel, it was designed for a server environment.
Spreadsheet Gear
You can try SmartXLS for .net,it has a calculation engine for Excel workbook,it does not depend on Excel.
Not sure if this is appropriate to your task, but could you not import it into Google Spreadsheets to make it multi-user? If it is really complicated then I shouldn't think this will work, but might be worth a try.

Resources