VLOOKUP task in Javascript - javascript

I am needing some JS that can Vlookup a piece of information from an XLSX or CSV file.
My example is this:
I have a spreadsheet containing balances of accounts.
When a person logs into their account, the variable 'ACCTNO' is currently set as their account number (example - 95785879).
I would like this to lookup the information from my spreadsheet which is found at C:\Users\Username\Desktop\AccountBalances.xlsx and return the balance of the account as shown below. In this example. the returned number should be £4.19.
Screenshot of Excel File

Javascript cannot access the local filesystem. You should consider putting this information in JSON format and declaring it in your JS code, or look at a server-side solution such as a database.

Related

How Send Data to Website Creator via a Client Event

I am creating a hopping website, and when someone creates an order and checks out, I want the following information to be sent to me, via email or some other method. There are a few pieces of data I would like to send (see below). The website is also static fyi.
I would like to send The Price they spent - a string, a list of all the items(I have an array of objects containing the data), and the shipping type - a string.
I also don't mind how the data is sent, as I'm the only one who needs this info.
Thanks!

Export data to excel(.XLSX format), structure in side the XL sheet is custom

How do I export data to excel(xlsx format) in UI5, structure in side the XL sheet is custom it is not like exporting entire table into XL. Data is coming from oData service, Please see the attachment for the format of the data inside the XL.
xl data format screenshot
in the XL we see on document and two lines, there can be more than one documents in that case we should see each document and followed by its line items.
I should be able to give file name and the sheet name inside the file
XL should have a header
it should be in .xlsx format
Short answer: UI5's job is not creating excel files so your question should not be related with UI5.
If you want to create the excel file in the backend and your backend is a SAP NetWeaver system, use abap2xlsx.
If you want to create the excel file in the frontend, I recommend using SheetJS. There are many examples on their website and GitHub repository, apart from many questions here at SO on this topic.
As you need freedom to create the file with a specific content, formatting and file name, making a call to an oData Service (assuming you have one) using ?$format=xlsx is not an option for you.

How to acquire data from users online?

I prepare to perform a simple project and I don’t know what I should use to accomplish this. I need to receive a data entered by a user (via a webpage) and store them somewhere. I need them to be able to search and returned on the user request. I’m a little old-fashioned so I assumed that should be a file on ftp managed by some python or JS script? I really don’t know where to start so please advise.
project
Have you considered storing data in a database?
You can use MySQL. It's quite simple after you understand how a database table works.
Data are stored in a table. Table is a part of a database with other tables.
Each table has columns you create. Data are added to the table in rows.
For example, let's say a user sends you their name 'Brian'.
You can have a table called 'users'. In that table, you can create a column 'id' of the user (read about it later, including auto incrementing), and 'name'.
You insert the data into that table. Brian is now in a table with his own ID, like this:
id Name
----------------
1 Brian
Check this out:
SQL tutorial
Possible solution i would recommend:
create a mysql server
create a backend (links for Java)
rest-service https://spring.io/guides/gs/rest-service/
access DB https://docs.spring.io/spring-data/jpa/docs/1.5.0.RELEASE/reference/html/repositories.html
put the parts together
get/save the data on your webpage with xhr2.

insert data to bigquery from gsheet

I would like to upload data to a table in bigquery from gsheet, I mean I want to upload the data with code and not with add on, because it will be scheduled later on.
Is there any code example that I can use for that for both ways (append and truncate)?
I have a 2 columns data that I want to load.
The columns are:
name lastName
josh big
john troble
May be some code using the following function
BigQuery.Jobs.insert(resource, projectId)
Looker is great on top of BigQuery and provides a very easy interface for embedding query results in google sheets (as well as excel).
http://www.looker.com/docs/sharing-and-publishing/publishing-looks-with-public-urls
note, I work at (and on) Looker, but I also love BigQuery
Here is a tutorial showing how to use Apps Script within a Google Spreadsheet to: (1) run a query and extract the results and put them into the spreadsheet, and (2) run a load job to import a file from Google Cloud Storage:
https://developers.google.com/apps-script/advanced/bigquery
Since that tutorial was written, BigQuery now supports inserting table rows directly through the tabledata.insertAll method:
https://cloud.google.com/bigquery/docs/reference/v2/tabledata/insertAll
If you want to upload some rows from a Google Spreadsheet into a BigQuery table, it looks like you can use Apps Script to insert the rows directly to BigQuery.
Another approach that should work: you can use Apps Script to create a file in Google Cloud Storage, then you can use example #2 from the first link above to load the data. The Google Cloud Storage API is accessible through Apps Script, so this should be possible. Here's a post showing how one user accomplished this step: http://ctrlq.org/code/20074-upload-files-to-google-cloud-storage
You might want to check Google BigQuery API in Apps Script
https://developers.google.com/apps-script/advanced/bigquery
Upload Job is to be used after you get data from gsheet
BigQuery.Jobs.insert

Remote poll using jQuery/javascript

I want to let my users create their own polls so they could paste my code somewhere on their website and users may rate their own game characters (with 1-5 stars rating).
I want to use jQuery or javascript for this purposes, but I have no idea how to start developing something like that. It should be free from being spoofed in any way, so I'd like to store the poll records in my database table (MySQL).
You probably had some experiences on this case, so I'm waiting for your suggestions.
Here is what I would do in a nut shell
First you are going host a javascript file and images for the stars somewhere, preferably on a CDN.
Second you need to setup a php file (or java or ruby or whatever you like for server-side) that can send and receive data via JSONP.
From here you ask your users to simply include the remote javascript file in the document head, and div on the page with a special class to signify that star rater (for this example .star).
Tasks:
Javascript: Populate all instances of <div class="star"></div> with your star images and set up.
Javascript: Request current rating tally average from server via JSONP with full identifiers (see step 4).
PHP: Use identifiers to find predetermined average of star rating so far, return current average rating as JSON. If non is found return 'unrated' state in JSON.
Javascript: Style stars so they all look correct, either displaying the current rating average received from ajax, or unrated state.
Javascript: Setup basic behaviors (hover style change ect.)
Javascript: Create click event bindings to stars. When user clicks you will have to send information about the rating to the server via AJAX JSON. This information needs to include the rating itself along with the url of the rater and any other identifiers.
something like:
{
url : 'http://endUsersite.com/pagetoberated.html',
starId : 'pictureOfBillMurray',
rating : 4,
raterIP : 192.168.1.130
date : UTCstringhere
}
Javascript: Restyle to show rating in progress and prevent future ajax from clicks.
PHP: Catch the JSON, process and store it in mySQL
PHP: After successful storage respond to ajax call with JSON stating the rating was successful
Javascript: upon getting 'success-response' of JSON, style stars to show successfully rated.
PHP: process ratings to determine new average.
You will most likely also want to implement some kind of timing system on the server-side to prevent rating spamming from the same IP address.
what have you tried? Searched?
Study the ones provided by sites like http://webpoll.sparklit.com/samples.spark
Obviously you will not see their server-side code, but at least you will see what is being received-stored-computed-sent at the client-side.

Categories