so I have an IQY file (Internet Query file), it's found locally on my computer. This file when opened in excel will show me a table of a SharePoint list. I would like to use JavaScript, in IE browser (I can use ActiveXObject if needed) to search the resulted table for a value.
I already know how to search in excel, So that's not the problem. How can I turn this IQY file into an temp excel sheet with JavaScript? If it's not possible, is there a way to read from the table using the IQY file without using excel?
I hope my question is understandable.
Thank you.
So I've found a way to overcome this problem. In the file data there's an href, that when opened by a browser will display the data in excel format. So I've used this data to get the information I needed.
Related
There is one requirement in javascript to export the data (array or array of objects) to excel xlsx. I already exported the data to csv but unable to do same for xlsx. I tried many api from github so that I can used the libraries and export it to xslx but there are little help for it. I tried using stephen-hardy/xlsx.js, SheetJS/js-xlsx etc.
For exporting to csv I used this Click here! but the same cant be done for xlsx.
I tried xlsxwriter also to convert and write javascript array or array of object to xlsx but no result.
Now I m badly stuck because of the requirement. I also found out the similar post as of mine requirement Click here!
Please guys give me solution if any
A while ago, I wrote the following article, which described how to export data from a jqGrid to a "real" .xlsx file:
Export jqGrid to Excel
This basically cached the jqGrid's data into a JavaScript variable, posted it back to a server, to save into Excel. The Excel file is created using the OpenXML libraries.
This should point you in the right direction.
Alternatively, you might like to try this library:
AlaSQL
(I haven't tried this though.)
Try excelbuilderjs, I have done the same of downloading a Json Object with array of items into an excel sheet using this library.If you can please share the code on Jsfiddle, i can take a look at it and help you out
http://excelbuilderjs.com/
I need to know if there is a way to retrieve the real file extension without parse the filename.
In my code I split the file using the function split(filename, ".") then i get the last element of the array that the function returns.
Now, if I create a .pdf file called, for example test_file.pdf, the previous method works perfectly, but if i rename my file to test_file(without extension) I cannot retrieve the extension even if I know that the file is a PDF.
For example, if i rename test_file.pdf to text_file.jpg how can I recognize that the file is still a pdf and not an image file with .jpg extension?
I would like to know if there is a way to obtain this information, maybe using file metadata or other information related to the file.
I'm looking for a Javascript solution because I have to check the extension when I upload the file using a form (client side) but even a Java solution could be fine, can you help me?
Thank you in advance!
Look at this post and the marked answer: Get real file extension -Java code
I guess it's just what you need.
I would like to generate an excel file with some visible data in a table I have.
I currently generate it like so:
$("#data_table tbody tr").filter(":visible").each(function(i,t){
//iterate through rows and collect data
location.href='data:application/download,' + encodeURIComponent(data);
});
Is it possible to define a mime-type for this response so it will be opened by excel?
This solution requires the browser to do "save as:" in order to open excel.
(Note: the rendering is currently not great either in the csv, I might skip this solution altogether and go through server side).
Now that was easy :)
I had copied the code from somewhere else, and while now editing it a bit to create this post, I really started looking better at it.
location.href IS containing the mime type!
So the solution is:
location.href='data:application/vnd.ms-excel,' + encodeURIComponent(data)
I am trying to display display .xls file data in a browser(prefer ie,ff,chrome and safari) as a web content.
The thing is i have an .xls file in my computer where i'll all the data manipulations in the xls file and want the data in it to b displayed in a browser for others to see just as a content in a webpage.
I am planning this with a javascript, could anyone help me with this? i almost tried all the possible ways and all the posts in many sites about this kind of procedure but nothing suited my idea. I wld really appriciate if anyone cld get me out of this problem.
You're almost certainly going to have to do this transformation server-side. Client-side javascript is going to be tricky if not impossible, because an XLS file is not HTML, and so cannot have <script> tags in it to tell the browser what to do. You could possibly embed the XLS in an iframe, and have the JS operate on it, but iframes can be a pain to work with, and are deprecated in HTML 5 (to my understanding). Even if this could work cleanly it still doesn't sound like client-side processing of the raw document is a good idea.
So first step is to investigate what server-side technologies (e.g. PHP, JSP, ASP) you have available. Second step is to find a library for one of these technologies that is capable of opening and reading XLS files (not a simply task). Then the third step is to write the required code to open your XLS file, extract the required information and output it as HTML. (It may help to think of this third step as transforming an XLS input into an HTML output, which is exactly what you're trying to do).
Is'nt it an option to simply save the xls as an HTML-document out of Excel?
The only way i know of, would be to set the file as the document source of an iframe tag, but this element is going to be removed from HTML as of version 5. In any way, your browser will have to support displaying those documents in your browser window.
Here is a code snippet how to import Excel to DataTable in your Excel ASP.NET application with use of this excellent Excel C# component:
private void Page_Load(object sender, System.EventArgs e)
{
var ef = new ExcelFile();
ef.LoadXls(Server.MapPath("../ExcelData.xls"));
// Initialize DataTable (skip this if you have DataTable definition)
var dt = new DataTable();
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("birth", typeof(DateTime));
var ws = ef.Worksheets[0];
// Extract data to DataTable
ws.ExtractToDataTable(dt, ws.Rows.Count, ExtractDataOptions.StopAtFirstEmptyRow, ws.Rows[0], ws.Columns[0]);
DataGrid1.DataSource = dt.DefaultView;
DataGrid1.DataBind();
}
I would like to save a csv file from a web page. However, the link on the page
does not lead directly to the file, but it calls some kind of javascript, which leads
to the opening of the file. In other words, there is no explicit url address for the
file i want to download or at least I don't know what it should be.
I found a way to download a file by activating Internet Explorer,going to the web page
and pressing the link button and then saving the file through the dialog box.
This is pretty ugly, and I am wondering if there is a more elegant (and fast) method to retrieve a file without using internet explorer(e.g. by using urllib.retrieve method)
The javascript is of the following form (see the comment, it does not let publish the source code...):
"CSV"
Any ideas?
Sasha
You can look at what the javascript function is doing, and it should tell you exactly where it's downloading from.
I had exactly this sort of problem a year or two back; I ended up installing the rhino javascript engine; grepping the javascript out of the target document and evaluating the url within rhino, and then fetching the result.