Can excel fill in certain fields based on variables from a website? - javascript

Our ecommerce platform will does not currently create invoices. I have an invoice template that I currently use in excel, so I essentially just copy and paste about 8 points of data from the ecommerce platform to the spreadsheet, then print it out.
Even though the ecommerce platform does not create invoices, that data can be sent anywhere I would like, including a website or email, so I've used it to automatically notify me of certain purchases via email.
What I am wondering is since the variables (eg. user_address) are always the same that are sent from the platform, can that information somehow be sent to an excel spreadsheet (my template), which will then be populated by the appropriate variables, so all that's left to do is print it out?
I'm not really a programmer, so any code snippets you can provide or some idea of whether or not this will take a programmer would be appreciated.

Yes, check out Apache POI, this would let you create something in Java, perhaps a servlet, that would catch the data from your ecommerce app and make a spreadsheet.
Alternatively you could make a Google Spreadsheet and an associated form and write some intermediary script in whatever language you like that will send the right post variables to the Google form from the ecommerce app. I would expect this solution to be much less involved.

I would suggest taking a look at APIs like JExcel, which lets you read/write cells of an Excel file using Java. If you send your data to an Excel file, and then pull it out using this package, you could get the desired results. You may still need a programmer for this method, although there would not be a lot of work involved.

Related

How to store and make changes to a database within a Chrome Extension?

I'm currently working on a Chrome Extension which searches for specific content within webpages.
Now, my idea is to build a Database based on the correctness of this search result (which would be verified by the users), so it can be more accurate in these searches as the database grows. Kind of like a Machine Learning process I guess.
I'm fairly new to programming and I would like your advice on what are the best possible ways to do this.
Currently I just have JS/HTML/CSS, and it seems to me that I'm gonna need some other language.
A single CSV that the Extension could read/write would be enough for this, I think. Or something with SQL.
Thanks in advance!
You have to compose and post a CRUD command to a web server page (a server you own or you controll)
That page can be written in php, asp.net..
Web server page receive the CRUD command and run the relevant statement on your database via OBCD driver (or other similar driver)
Normally the web server page then responds, as a result of your post, with a message (text, xml, json) that makes you understand if the command has been successfully executed or not.
EDIT 04/30/2021 16:24 Rome Timezone
you say:
which would be verified by the users
what did you mean exactly?
more users together contributes to make the shared database better ?
or every single user contribute by itself to make his own database better ?
if one then my previous answer could be a good start point.
if two, forget my previos answer a think to build a indexedDB within your extension.
Read a csv or txt file through XMLHttpRequest is not a problem, but how do you thing to write the same file with the same tool (XHR) ?
You could think about a Google public spreadsheet.
"Google Sheets" allows you through an "endpoint url" and a set of API to insert new rows\records and to read the entire content of the spreadsheet
or (if I remember correctly) part of its content.
I state that it's now 2 years or maybe more since I got interested in Google Sheets.
Based on the information in my possession, perhaps outdated,
I can tell you that "Google Sheets" it is a path that I DO NOT advise you to follow.
First, because spreadsheet url being public would allow an attacker to pollute your DB by inserting many rows\records
by simply typing a url in the browser's address bar or creating a simple bot that inserts thousands of lines in a while.
Second, because that set of API do not allow you to implement very sophisticated queries (certainly not at the database level).
If you are really interested in Google Sheets I suggest you check what I have just stated.
If you have to "waste" energy to learn something new
I would suggest you to give priority to SQL and then to a server-side programming language (php, asp.net, node.js)
However, a free space hosting service with php and mySQL support is not too difficult to find.

Can I limit who can view a .js file while allowing my webpages to view whats contained within?

The question may seem vague, so i'll state what I want to do in my project and how i'm going about it.
I create estimating workbooks in excel that operate like fully executable programs with a GUI using VBA. The workbooks themselves are used to estimate specific projects. For example, I've created workbooks for estimating basement developments, kitchen renovations, bathroom renovations and other residential renovation projects.
The back end sheets contain the formulas for estimating different tasks and trade/material pricing. In the back end of these workbooks is the mark-up and margin values. The great thing about it, is I can lock the access to the sensitive information so that only select few people can view or modify the values. The front end of the workbook allows the estimators that work for the companies I build these for, limited access. It also reduces the amount of errors an estimator can make.
At this point, i'm building a web app using Javascript/jquery to increase my client base. With the excel workbooks, only those using excel can work with the workbooks due to, as I understand, excel being the only program that can run VBA macros.
The Problem:
Due to my limited knowledge of PHP and SQL, I havent set up a database to store and PHP files to retrieve information.
To get around this, I'd like to store all of my global variables in a separate .js sheet, inaccessible from the developer tools on any browser. This way I can hide from my clients competitors and clients the information on profit margins and individual costs of their projects. A separate sheet would also make it easier to update values. I would also like to hide the general structure and framework so that it can't be easily imitated or copied.
Maybe there is another solution to what I'm looking for?
Thanks for your help in advance!
No. If you need some information to show a webpage and don't have any server-side code, the information must be in the user's browser.
On the other hand, I never tried writing or hacking VBA so I don't know how hard that is, but conceptually it simply can't be different: if you compute something on untrusted client's computer, the data used in the computation is not secure.

How to use JDBC to send Google From response to Cloud SQL?

I work for a non-profit that holds free sports and physical activity events. I'm am trying to set up a system to store and collect information about our membership and the events we hold, using Google Docs as the user interface and Google Cloud SQL for data storage.
Like most non-profits, we do not have a lot of resources available for advanced computer programming. I would like to use Google Forms as a simple UI that our research and evaluation staff can use to build data collection tools without coding. The ease of access to the responses in Google Sheets is great; however, we hold a lot of events and will quickly exceed the 2 million cell limit. So, I think we will need to store the responses in a SQL database.
What I would like to do is modify the action performed on submit, such that the form:
Does NOT submit to a sheet
Connects to a SQL table (I've set this up on Google Cloud SQL)
Dumps the responses into the correct columns
If the form was modified, add any new columns to the table (like Forms does with attached sheets).
I know that Google Apps Script can connect to external databases through the JDBC service (https://developers.google.com/apps-script/guides/jdbc) and I know that I will need to use the getItemResponse method (https://groups.google.com/d/msg/google-appengine-stackoverflow/laLkcneaqZo/PfPKKYlmva8J) to execute this.
I have very little experience with Google Apps Script or JavaScript in general....basically, the most I've done is finish the Codecademy JavaScript course. However, I am a quick learner and I'm looking for a little example code that might get me started (remembering that I have almost no experience).
I've searched through this forum, GitHub and everywhere else I can think of, but cannot find something that is quite right. I'm mostly pointed to the JBDC documentation, but do not know how to use it. Any help you can provide would be much appreciated.
Brett
I wrote some articles about this at my blog, Bit Vectors. This article might cover most of what you need. That specific article explains how to build a Google Apps Script solution tied to a Google Sheet file. The GAS solution front-ends Cloud SQL. The end-user sees a web page / form, and if you want, the Google Sheet itself. To answer your list items:
1) The web form does write to a sheet, but in the software, you can easily prevent this
2) The web form definitely connects to your Cloud SQL table / database
3) The solution writes to the table(s) / column(s) you want through stored procedures
4) The solution will not modify the data table structure if you change the form - you would have to handle this change yourself
See a demo here.
HTH!
Frank

How to apply filtering of excel workbook based on credentials?

I need to apply filtering to an excel workbook. Specifically, I need a way to automatically apply filtering to 1 column based on the login credentials of the user so that they only "see" what they need to. Ideally, this will happen when the user enters credentials to unlock the workbook or sheet. Can this be done with Javascript, VBA or a 3rd party app? Thanks in advance!
Answering your second question, your choice for desktop code execution in Excel is going to be Visual Basic. It is what macros run inside Excel.
As for can it be done? I can tell you that there are plenty of objects in Windows to which you can attach a vb script through OLE or COM to get the current user credentials, such as WMI.
But the problem is that macros can be disabled by the user, so if this is for security reasons, you might not have the right solution given the most readily available tools - that is to say, maybe Excel isn't the place for the data but SQL Server would be a better choice.

Google Gadget, Javascript (Or Other) Way To Port Collected Data

I am working on a Google Gadget that will collect some data through Google API's. What I am getting stuck on is how to collect the data and then save it somewhere to be processed later. The final idea being that I would run the gadget on my own computer it would collect the data and then save it to somewhere on my own computer. (I guess I want to emphasize that this is, for now, a small personal project and does not necessarily need fancy server scripts, I want to be able to run this all on my PC running XP).
Is there a pure Javascript way to save a file on a computer?
Can I use other languages besides XML, HTML, and Javascript to add functionality to my Google Gadget?
Edit: The goal of this is to be able to log how many of my contacts are signed into gchat over a period of time. I decided on a Gadget because that was the only way I could figure out how to access that information. Any other ways to approach this idea are welcome!
No, Javascript alone cannot save a file automatically. And be careful, javascript is affected by the no cross domain rule. If you're hosting the project on your own computer, why bother writing a complex Google Gadget?
I suggest a simple PHP script, and MySQL, if you like, to store the data. By itself, PHP should be more than enough to run most tasks. If you would like me to add in more info about this, please tell me what type of task.
In increasing order of flexibility:
The options object is almost certainly the easiest approach - not really designed for that kind of usage but I suspect it would be fine for your use case.
On windows you could use system.filesystem to get hold of the WScript FileSystemObject which you can then use to create files and write to them.
Also see the Google desktop API blog for embedding an SQLite database in your gadget (looks pretty easy).

Categories