Is there any way wherein I can read data from an Excel file(from a Column) change the I/P of the Column Value in a HTTPS URL and then fetch the value from the Web Page and feed the I/P corresponding to the Row in another column which can be used in Shell.
I have googled and found that we can use Selenium and Apache POI to read and write into the Excel however how do I read the data from the Web Page.
You can use node.js to fetch data on the web.
then you use node module
https://www.npmjs.com/package/excel-export
to make it as an excel sheet or
https://www.npmjs.com/package/node_spreadsheet
Related
I am trying to read an Excel file using Java.
I did this successfully by using org.apache.poi which is returning all of the data column wise.
But now I want to read the same excel file by column names only which will be given by the user. The twisting part is that I want to accept column names from a property file and only those names, which are in the property file, those column's data should be shown by the program. So any suggestions? How do I do it?
use net.sf.supercsv library for reading EXL file by header/column name
I am reading encoded data from database. When I decode data I get something like
%PDF-1.3
23 Obj
xref
10000000 123n
.
.
.
.
%EOF
I am guessing it's a metadata of PDF file with data. My question is how do I create PDF file out of this with readable data only.
Thanks in advance.
First you need to know what the data in DB represents. I would suggest to connect to the database using a general client. For example, for Oracle - SqlDeveloper, for MS Sql Server - Visual Sql Server, etc
Display the table which has a column of type long, clob or blob and try to save it to a file. Name the file with an extension .pdf. Try to open the saved file and see if it gets open correctly by a pdf reader.
If this is a case, saving it from Java is trivial. For example: http://www.astral-consultancy.co.uk/cgi-bin/hunbug/doco.cgi?11120
I have uploaded Excel sheet data (office 2007 version) and it is correctly inserted in MYSQL. When I am fetching it on JSP page it is not displayed and I didn't get any error. While data before uploading excel sheet is properly displayed. And when I delete those data coming from Excel sheet, then it is again OK.
How to overcome this problem?
It could be that via Excel you put text in wrong encoding in MySQL. Then Java would throw an Exception if a byte sequence is illegal. This can be the case if Java expects UTF-8, or the database field contains Excel with UTF-16 (byte pairs). To diagnose this, upload an Excel with pure ASCII. If you see that, UTF-8 is guilty.
To repair, ensure that the database/table/field is UTF-8.
I have a JSP in which I want to:
make an HTTP request;
get back the XML response;
transform the response using XSL; and
export the transformed data to excel.
But i do not get the entire data in a single HTTP call. Also I have to use two stylesheets for exporting to Excel. The first is for the first page of records, and the other is for all the other pages.
How can one do this in Java?
Thanks
Or use Apache POI, its a powerful API to read and create MS Office documents in Java.
Could you parse the XML into Java objects, then when you have the complete object list simply write the Excel file using JExcelAPI? I've used this for Excel files and it's very simple & useful.
I wanted to know if there is a way in which I can pass an HTML table from my JSP page using the Java request object.
More precisely, this is what my table looks like..
table id="tableid"
thead
tr
th...column1 header.../td
th...column2 header.../td
/tr
/thead
tbody
tr
td...column1 data../td
td..column2 data../td
/tr
/tbody
/table
I've a method in my Java code getExcelVersion(), for which I wanted to pass the above table as an argument.
I actually wanted to pass data from the table(column1 data, column2 data) as an List, ArrayList or anything data type, and not the actual HTML. What I'm basically trying to achieve is something as follows:
I've an HTML table, that I need to export to excel on a button click. For this purpose, I'm using libraries from Apache-POI, and the foll. code block.
HSSFWorkbook workbook = getExcelVersion();
resp.setContentType("application/vnd.ms-excel");
resp.setHeader("Content-Disposition", "attachment; filename=\"contacts.xls\""); workbook.write(resp.getOutputStream());
resp.flushBuffer();
Now, I wanted to know how would I pass table data(column1 data, column2 data) to my getExcelVersion() method.
Thanks,
Pritish.
Apache POI doesn't take a HTML table as input, but just fullworthy Java objects. Just reload the same data in the servlet as you loaded for the initial display in JSP and then feed it to Apache POI instead of forwarding to JSP. If you want to avoid reloading the same data, then you can consider to store it in the session scope, but this has a negative impact on server memory usage and client experience.
At least, I'm assuming that your JSP/Servlet/database code is well written, else it's going to be a lot of refactoring/rewriting work.
Related questions:
How to avoid Java code in JSP files?
Hidden features of JSP/Servlet
Export to Excel (CSV) using JSP/Servlet