Reading from an excel file
I was wondering, what do i need to look at to get cracking with making a programme that can read from a excel file
I was thinking of making a programme that uses a excel spreadsheet <this spreadsheet is made and provided by the national lottery and has all the winning combinations that have been drawn in past draws> and reading them in and generating a list of combinations that have not occured yet
Its just for a bit of fun, but could be a good challenege
thanks
PaulOckleford wrote:
If all you want to do is select from the excel sheet you may find it easier to use the jdbc option, I have an example of some code I wrote that does a select from an excel sheet and it may be useful for you:Just my opinion here but I would avoid using odbc to deal with the spreadsheet if at all possible.
Time for a war story:
After losing an argument with some business, marketng and management I had to develop a program that accepted spreadsheets as datafiles and it was nothing but trouble.
I experienced all kinds of type problems, the most common and annoying of them being
that the driver (via some logic unknown to me) will determine the type of each column.
Any data that is does not match that expectation is dropped (I found that the query returned NULL).
As far as I could tell there was no way to make the driver treat the data the way you want it too.
After much trouble and lots of manual intervention by the poor person who has to deal with this data on a regular basis it seems to be working but it was not fun it is still very ugly code.
You may not end up reliving my tale of woe, but I though I would give you some fair warning.
As I continue to say "Spreadsheets are not a reasonable data transfer format."
Similar Messages
-
How to read from MS Excel file ?
Which is the best way to read from a MS Excel file ?
I need to read both "column-wise" and "row-wise".
Is there any free software or java api which does this. I have come across some paid softwares which do that, but i would prefer using something which is free.
I have tried using the "save as" option to save as tab delimited, comma delimited, unicode text ... but they raise too many exceptions, and cannot be read as we read a normal text file.
Please do suggest.
Thanks.http://forum.java.sun.com/thread.jsp?forum=31&thread=289935
http://forum.java.sun.com/thread.jsp?forum=4&thread=285062
If you would search of the forums, you would find these two threads, and probably many others. They not only include pointers to what you ask but discussions of the pros and cons among various solutions.
/Mel -
Is there any way to read the data from an excel file w/o using a loop structure?
I am retrieving a large amount of data (multiple sheets) from an excel file and would like to extract the entire range without retrieving individual cell values(too slow). I can write an range all at once but cannot read it.
If you are able to write a block of data, then you should be able to read a block. The four requirements that you want to verify are:
1. The Range specified must match the exact size and location of the data block you want to read
2. The returned data is in a 2D array of Variants (either strings or numbers)
3. Use Variant to Data to convert to 2D DBL or 2D Strings
4. Check for the correct orientation for your application (use transpose if it is not)
Michael Munroe
Certified LabVIEW Developer
www.abcdef.biz
Michael Munroe, ABCDEF
Certified LabVIEW Developer, MCP
Find and fix bad VI Properties with Property Inspector -
Reading data from an excel file
Hi,
I want to read data from the excel file and display it in
jsp page. Iam getting the following error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:odbc:mydsn","","");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from [holidays$]");
Here i have created the dsn with the name "mydsn". I have the
following data in the mydsn.dsn file:
[ODBC]
DRIVER=Microsoft Excel Driver (*.xls)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
ReadOnly=1
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=excel 8.0
DriverId=790
DefaultDir=D:\WorkSpace\Projects\VINET\devl\webroot\jsp
DBQ=D:\WorkSpace\Projects\VINET\devl\webroot\jsp\list_of_holidays_2003.xls
thanks in advance
phani.You might want to look at the POI project (an open source Jakarta sub-project) that allows you to create/modify/read excel files via Java code. That might be more flexible and easier than what you're currently trying to do.
Cheers -
GUI_UPLOAD to read data from an Excel File
Hi Folks,
I'm using FM GUI_UPLOAD to read data from an Excel File. But all I see in the table returned is 1 row with garbage values (special chacaters). Excel Workbook has proper data in the sheet, but its not getting uploaded properly. Sy-subrc is 0.
What could be the reason?
Thanksuse FM : ALSM_EXCEL_TO_INTERNAL_TABLE
See the example program to get from XLS file to Internal table
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data -
Help! How to read data from an Excel file?
Hi,
I need to read data from an Excel file that may contain more then one table in a sheet. How can I read them?
I would be eternally grateful to anyone who can give me any information.Did you try POI from Apache?
http://jakarta.apache.org/poi/index.html -
Photoshop plugin/script to have it read and create a new file from an excel file?
I do prepress and cover design for our book manufacturing company. I have made a tool that I input book specs into and it tells me the exact size of the photoshop document I need to create for an accurate book cover layout. It calculates total width, height, spine placement and spine width, bleeds, and even where to place the adobe guides in the document.
I've always book toggling back and forth on my mac to get the measurements etc while I am designing a cover. What I want to know is if there is a way this can all be automated.
I know photoshop supports scripting and plugins but I have not found anything remotely along the lines of what I am looking for. If I could get this process automated somehow my workflow and productivity would shoot through the roof!
In short I am looking for a script/plugin for Adobe photoshop CS3 that can read from an excel sheet and create a new document based on the specifications in that excel file.
Does anyone know if this is already out there? Or if it can be done? I would certainly invest in this.
Thanks!xbytor answered to you already for javascript.
It's something that is very easy to do using applescript (scripting excel through excel applescript dictionary, i have used it for a projet, found it usefull for the scenario i was working with, but it was incredibly slow.. same thing in Realbasic when driving application through automation.
Depending on the number of record that need to be processed (if you dont have to fetch data in different tabs) it's often better to have a "pre-process" to save the excel file as a CSV and using any other solution to process the text file. Can make a HUGE difference in processing time...
You will surely be able to find a professional to help you with this task if you willing to pay for custom developpement.
If you have internal ressource or want to give it a try yourself, have a look at this:
http://download.microsoft.com/download/3/A/7/3A70FB4B-0C6A-43E3-AAB7-AC9166B25632/Excel200 4AppleScriptRef.pdf
ps: Beware! The dictionnary can have little difference depending of the excel version that you use. -
Reading data in excel files from client side
Hello Experts,
I want to build a website from which clients can upload data in the excel sheets they have into the sql server 2000 on the database server.
These excel files will be at the client machine from where they will upload all the data from the excel file to database server through this website.
Can you please help how to go about doing this.There are two open source projects that will help you out: Jakarta POI and JExcel. Both can serialize and deserialize Excel files to Java. You can also use the older ODBC-JDBC bridge, which can both read Excel files (albeit in a limited way with SQL syntax) and then output to your SQL Server.
- Saish -
Read a Column from an Excel file
Guys,
Is there a way I can read a specific column from an excel file, use that data to query and select data from a table and then insert the output into another column of that same excel file.
Please advise! Thanks> Is there a way I can read a specific column from an excel file, use that data to query and select data from a
table and then insert the output into another column of that same excel file.
Not easily. An Excel file is typically in a proprietary binary file format. Perhaps saved using the new MS Office XML format.. which would be possible to process via Oracle's XDB.
But assuming it is in a binary format, you need "something else" to read and parse that file for you - like ODBC or DDE or COM/DCOM, etc.
Oracle supports Heterogeneous Database Services. On a Windows Server, you can create a database link in Oracle that uses an ODBC driver to connect to an ODBC data source. There are ODBC drivers for Excel. However, this requires the data in the worksheet to be properly marked as a data table. Or did last time I looked at it about 2 years ago.
You can also call external "interfaces" from PL/SQL using EXTPROC - such interfaces can be DLLs. Which means you do have access to the Win32 API and application APIs from PL/SQL. This can be used to access the content of an Excel file - DDE for example can quite easily do this (you use it to peek the contents of an Excel grid location), but requires Excel to be running and that spreadsheet to be loaded. DDE can also be used to poke contents (write something back to a cell in a spreadsheet).
But using Oracle code to use an Excel file as a kind of database file... that IMO does not make a lot of sense. At all. -
How to read data from the excel file using java code.
Hi to all,
I am using below code to getting the data from the excel file but I can't get the corresponding data from the specific file. can anyone give me the correct code to do that... I will waiting for your usefull reply......
advance thanks....
import java.io.*;
import java.sql.*;
public class sample{
public static void main(String[] args){
Connection connection = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:odbc:Mydsn","","" );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
System.out.println("sample:"+rs);
ResultSetMetaData rsmd = rs.getMetaData();
System.out.println("samplersd:"+rsmd);
int numberOfColumns = rsmd.getColumnCount();
System.out.println("numberOfColumns:"+numberOfColumns);
while (rs.next()) {
System.out.println("sample1:"+rs);
for (int i = 1; i <= numberOfColumns; i++) {
if (i > 1) System.out.print(", ");
String columnValue = rs.getString(i);
System.out.print(columnValue);
System.out.println("");
st.close();
con.close();
} catch(Exception ex) {
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}1: What is the name of the excel sheet?
2: What is printed in this program? null ? anything?
error?Excel file name is "sample.xls" I set excel file connectivity in my JDBC driver(DSN). Here in my program I am not giving that excel file name. I am giving only that excel sheet name. that is followed
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );The output of this program is given bellow.
sample:sun.jdbc.odbc.JdbcOdbcResultSet@1b67f74
samplersd:sun.jdbc.odbc.JdbcOdbcResultSetMetaData@530daa
numberOfColumns:2 -
How to retrieve data from an Excel file which is located on server
hi everybody,
I am using SAP NWDS 2004s .
I have done an application on how to export the table data into an Excel .
Now i want to get the data from an Excel file which is located in server and display that data which is in excel in a View for example a Sample view in Webdynpro .
In Sample view i took a uielement textview to display the data ....
can any one help how to procced further
Thanks in advance
MadhaviOptions to read Excel data to WebDynpro context
Reading Excel Sheet from Java without using any Framework
Reading Multiple Sheets of Excel Sheet from Java
Few Threads
How to Display the content of Excel file into Webdynpro Table
Is it possible to upload data from excel file(.xls)
Re: How to export the data as integer into excel sheet?
regards
Vinod -
Hyperlinks from converted excel file are not working after pdf file is moved
I have created a pdf file from an excel file that has hyperlinks in it. The hyperlinks work fine if the files are all kept in the same exact location as the time they were created. Once the files are moved (i.e. emailed to another user) the hyperlinks no longer work. An error message pops up that the file can not be found. Is there a setting or something that I'm missing in acrobat that allows for the files to be moved, so that the hyperlinks still function properly, after creation
No settings adjustments.
The issue is that links, once made, have a specific path (as shown when you view the link's text string).
When you email the files the person who recieves the email and downloads the attachments would have to have the same layout of files/folders you have.
Without that links are "broken"
You email a zip file that, when extracted, would create the folders/files in the required layout to reflect what you have.
Be well... -
How can I create multiple QR Codes from an Excel File?
Hi there,
I am currently trying to set up business cards with a QR Code on the back of each card. Therefore I have an excel spreadsheet, which contains all the data necessary for the business card like name, function, e-mail adress,... the data is then filled in automatically by using the standard function with tags for each column (e.g. table column name is filled in as <<name>> in the specific location on the business card and once executed it is matched with the data from the excel file).
Is there anything which could help me to automate the personalization of the QR Codes?
All the bestFor free? Not at the moment. CC does have the ability to create QR codes but only one at a time. In CS6 (perhaps earlier versions?), regular poster/advanced scripter Jongware devised a script to prepare a QR code but again, could only do one at a time.
However, someone did build on Jongware's QR code to do this from an InDesign file that had the necessary information in tagged text boxes and would prepare QR codes accordingly. However, it would leave them in the InDesign file (e.g. not separate EPS/PDFs).
So, a long workaround would be:
install the script and read the thread on the adobe forums (jongware's QR code plus the additional improvement): http://forums.adobe.com/message/4787823#4787823
data merge the current data into the indesign file using the similar structure as the fourth poster in that post had written
once all the QR codes are written, create a PDF of the file and then use one of various methods to break up the PDF into single page files: http://colecandoo.wordpress.com/2013/07/13/breaking-up-is-hard-to-do-indesign-files-into-i ndividual-pdfs-that-is/
It's a lot of work to generate multiple QR codes. A paid solution offered by either Meadows DPS or Woodwing (two companies I have no affiliation with whatsoever) or any other plug-in provider for that matter: http://www.adobe.com/products/indesign/indepth.displayTab3.html may be an alternative that is worth pursuing. -
How can I import contacts into my icloud contacts from an excel file?
I need to add contacts to my icloud contact data base. Can I import from an Excel file?
Thanks,Not directly, export from Excel to a .csv file, then convert the .csv file to a .vcf (vCard) file. Then iCloud can import the vCard file.
Here is a free csv to vcard conversion utility. -
Having issues Creating a PDF from an Excel file
When creating PDFs from an Excel file using the Adobe PDF printer, I sometimes run into an issue where the PDF ends up shrinking what's on the document and distorting the image. I have examined all Print Settings and can't find a difference between any of the margin settings, paper size, etc. Once I go to print to Adobe PDF, it just changes the way the whole document looks and is spaced.
To work around the issue, I use Microsoft's built in Save As PDF feature, but that's only works some of the time. I would like to use the Acrobat software so that I can also edit the document immediately without having to re-open it.Be sure Adobe PDF is selected as the printer in the print menu. Then do a print preview. It it looks wrong then, it is likely an Excel format issue.
Maybe you are looking for
-
Error while calling a adobe form?
Hi All, in my webdynpro component , i am calling adobe form.but i am getting error as mentioned below. Error when processing your request ....... Webdynpro Exception:The ADS call has failed.you can find information about the cause in the error.pdf
-
Navigation: stop automatic slide advancement with multiple click boxes
5.0 newbie question. I know I have a lot to learn about navigation before I develop another CBT, but I have done a beta test and found a situation I hadn't encountered before, so I am looking for help to get me past this with a band-aid until I can
-
I want ti implement the following
Hi everybody, I have to implement the following idea and I dont know how. Any help will be apprciated. The idea is to scan an array for zeros, one a sequence of zeros is found then find its center and save in another array ? The folloaing image illus
-
WRT160Nv3 issue with Mac laptop
Mu daughter came home from school and connected wirelessly. She said it was slow and after a day could not connect to the network at all. I am on a pc,connected to the cable modem and router, and there is a pc across the room connected wirelessly. Ca
-
Hi. I am working on a Mac OSX 10.10.2 Yosemite. I'm working remotely with a woman who is using indesign CS8.2 I'm still on CS6.8 and can't open her files. I would like to upgrade to the latest version and I'd also like to know why these upgrades are