What is excel file's maximum column number limit?
Hello all,
I am writing a long csv string within one line to an excel file. When I open the generated excel file, it reports "File not loaded completely". And it only generated patial file.
I am thinking maybe excel has maximum column number limit, and my excel file required more than 312 columns, that's why it caused this problem.
Does any one know the answer?
Thanks in advance !
Rachel
Ok, I already solved this problem, excel has a 256 column limit.
Thanks,
Rachel
Similar Messages
-
Importing Excel File Setup by Columns
I have an engineer that is requesting data to be converted from an Excel file for use in DIAdem. The file is a compilation of data based on a search query in a database. Each line is a seperate occurance logged in the database. In the example below "TEMPERATURE MAXIMUM" was searched over a certain time period for a particular Unit ID. To import this into DIADEM I would want to make each unique UNIT ID a group, and each unique Definition Description as a channel name within the corresponding group. For the data I would want to have Begin Capture Time as a time channel ( it would need to be organized from earliest date to latest) with it's corresponding value placed into the channel named by the definition description.
I also have the ability to export the fiel from the database program into a .csv file.
Can this be done usign the standard import wizard. I was unable to find a way.
-MK
Attachments:
MKCImportExample.xlsx 10 KBHi MK,
You didn't see any difference because you didn't query the data in the file-- see the attached screenshot of what that looks like. With a query you can pick exactly which rows you want to load from as many files as you want. It's hard for me to guess your use case based on 14 rows of data that are all temperature. Are you usual data files longer than this? Do you ever have data other than Temperature in those data files? Do you want to compare data from multiple files?
I would welcome a set of ASCII files, if your process is to import those CSV or TXT files into Excel. Then the DataPlugin could save you that steo as well.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
Attachments:
Data Query View.png 102 KB -
Read from excel file stops at column 5(E) returns error at data variant function
hi,
i am read an excel file approx 15 rows by 16 rows.
The vi works fine upto 5 rows and 5 columns and prints data on front panel after using data variant.
The Cell range are also seems to be correct for higher rows/columns but then the errors occurs at data variant to 2d dbl stage.
Any idea what might be wrong in the vi
Thanks
chintanThanks for the reply.
I found out what was wrong the data types should be the string type and i was using DBL. -
Opening Excel file now shows column type in field value...
Just in the last 2 weeks, excel files that have fields set as 'General' are now displaying the word 'General' in the field. If you change it to another type (i.e. number or text) then it just displays the value. The file is originally created in OpenOffice and saved as an MS Excel file and works fine being opened in Excel on Micorsoft. It only has this problem on the iPhone and just started in the last 2 weeks. Any ideas?
Hi Vijay,
Just go through with this thread may be it will help you......
Are You All Able to get the Output In EXCEL Format
Regards
Ravi -
I've imported an Excel file, but the columns won't add up or respond to formulas?
Hey everyone
I'm working out my expenses for the year for the taxman. Lion won't open my Excel files, so I grabbed Numbers and opened it there. The data is all intact but the "total" cell no longer update, and I get formula error messages when I try to create new sums. Any clues to a workaround?
Thanks
CHello Badunit
The formula was using SUBTOTAL()
In fact, when I urged him to put the formula =SUM(D), the OP just inserted a new standard row so, of course, he got the error flagged by the red triangle.
In the imported file, the cells embeddinbg the subtotals were flagged by a blue triangle (top_left)
The import process ended with a long, dense report describing the changes brought to the original document.
No need to post it here, on my machine it's in French
When I got the doc I was just puzzled during 10 seconds because the currency, in the Numbers document filed by the OP was displayed in front of the amount £UK123,45 when the import of the XL document was delivering tables with values displayed as 123,45 £UK
But it didn't mattered.
When I inserted two footer rows,
one for the imported totals,
one for the formulas =SUM(column) both documents behaved the same correct way.
As I have no practice of XL, I don't know if headers and footers with the Numbers meaning exist in this app.
If they don't, it's not surprising that newbies are surprised.
Yvan KOENIG (VALLAURIS, France) jeudi 11 août 2011 18:26:04
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
Store data in excel file in multiple columns
Hi,
I am working on a data logger type of project. I have to store data received from serial port into excel file. I have attached images of data I am getting at serial port ,image of how I want to store data in excel worksheet and image of VI i tried.
please note that I know VI I built is incomplete. I have mentioned in image, In which part exactly I need help...
If anyone can suggest more efficient ways to do this that will be very helpful.
Attachments:
serial data.png 79 KB
SerialDataLog.png 31 KB
serialDataWithOutNames.png 64 KBYou are not writing to an Excel file -- you are writing a "spreadsheet", which is entirely different.
It is usually a good idea to write yourself some documentation, as it can help decide how to structure your program. For example, do you collect all of the data, and then write it all at once? That suggests three sub-VIs, "Acquire Data from VISA", "Extract Data from Serial String", and "Output Data to Excel". The output from the first VI could be an array of Strings that look like "XCount: 123 Depth: 456 YCount: 789", the output from the second could be a 2D array whose columns are the XCount, Depth, and YCount values, and the third sub-VI would take this 2D array and use the Report Generation Toolkit to write a true Excel file (.xlsx) with headers XCount, Depth, and YCount and containing the values from the 2D array. Each of these tasks is relatively simple to do "stand-alone", and it will be much easier to maintain/modify your top-level design if you only have 3 sub-VIs (with maybe some "bookkeeping functions" like getting file names) to worry about.
On the other hand, if you need to acquire/parse/output a point at a time, this can still be done, but now you have to mix everything together. Still, conceptualizing it as three sequential tasks (and maybe making three sub-VIs that do "one piece" of each task) might help you develop your algorithm.
Bob Schor -
Need suggestion in uploading dynamic excel file to corresponding columns of internal table
Hi Friends,
I have an excel file which doesn't have standard template. Just the users will key in their header (in row1 ) and followed by item details in excel and upload to internal table. Now by doing some internal developments in program I need to place the values in corresponding fields.
Let me explain with some examples.
1. I have an internal table
data : begin of itab occurs 0,
f1,
f2,
f3,
f4,
f5,
end of itab.
2. I have excel file as below
3 . Now i need to fill my internal table itab as below
Need to be placed in corresponding fields.
4. When I used GUI_UPLOAD FM it updates internal table as
Please give me suggestion on how to achieve it.
Thanks in advance.Hi Kumar,
use a temporary table to get excel values and then parse them to a second table with the format you want.
This is pretty basic.
regards,
Edgar -
Upload of Excel File with variable columns
Hi All,
I have a requirement where i have to upload xls file into SAP. This xls file has 10 rows fixed but the columns may vary from 20 to 400.
For Ex : My xls file has 10 rows and 27 columns filled at present. But in future columns can vary to 400 or more than that also.
So when i use ALSM_EXCEL_TO_INTERNAL_TABLE as
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_fname
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 400
I_END_ROW = 10
TABLES
INTERN = itab1
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
It throws SY_SUBRC = 2.
Please let me know how i can solve this issue.
Thanks,Hi Ashwani,
I will send a sample code for ur problem.Please the check the function modules i have used and procedure i followed.My function modules can work for any no.of rows and columns ok..check it once..
Along with my code i am sending a flat file.plz copy the code and execute it and debug it ok..i will attach flat file at the end of the program check it once ok...
code:
*& Report YBDC_UPLOAD_MM01_XLS *
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : MAKE CHANGES TO DOWNLOADED FILE AND UPLOAD THE FILE *
*& CREATION DT: 3/12/2007 *
*& REQUEST : ERPK900035 *
REPORT YBDC_UPLOAD_MM01_XLS.
Tables
TABLES : mara. "General Material Data
Global BDCDATA Structure and MESSAGE Structure
DATA: gt_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
gt_msgtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
Global Variables
DATA: gv_infile TYPE string,
gv_msg TYPE string,
gv_update VALUE 'A'.
Internal Table
DATA: BEGIN OF gt_data OCCURS 0,
matnr(20), "Material Number
mbrsh(20), "Account Group
mtart(20), "Material Type
meins(20), "Base Unit Of Measure
maktx(20), "Material Description
END OF gt_data.
Selection-screen
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename,
p_mode.
SELECTION-SCREEN : END OF BLOCK b1.
Select the File
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM fetch_file.
START-OF-SELECTION.
Fetch Data From XLS File
PERFORM fetch_data.
Fetch Data From XLS File
PERFORM delete_headerinfo.
Fetch Data From XLS File
PERFORM place_data.
*& Form fetch_file
text
--> p1 text
<-- p2 text
FORM fetch_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_file.
gv_infile = p_file.
ENDFORM. " fetch_file
*& Form fetch_data
text
--> p1 text
<-- p2 text
FORM fetch_data .
refresh : gt_data. "Clear Body Of the Internal Table
clear : gt_data. "Clear Header Line
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_infile
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = gt_data
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
ENDFORM. " fetch_data
*& Form place_data
text
--> p1 text
<-- p2 text
FORM place_data .
LOOP AT gt_data.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=AUSW'.
PERFORM bdc_field USING 'RMMG1-MATNR'
gt_data-matnr.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
gt_data-maktx.
PERFORM bdc_field USING 'MARA-MTPOS_MARA'
'NORM'.
CALL TRANSACTION 'MM02' USING gt_bdcdata MODE p_mode
UPDATE gv_update
MESSAGES INTO gt_msgtab.
*For Error Messages Handling.
LOOP AT gt_msgtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
lang = sy-langu
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = gv_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF sy-tabix = 1.
WRITE: / 'Process Log' COLOR 3.
ENDIF.
WRITE:/ gv_msg.
ENDLOOP.
REFRESH gt_msgtab.
REFRESH gt_bdcdata.
ENDLOOP.
ENDFORM. " place_data
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR gt_bdcdata.
gt_bdcdata-program = program.
gt_bdcdata-dynpro = dynpro.
gt_bdcdata-dynbegin = 'X'.
APPEND gt_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
CLEAR gt_bdcdata.
gt_bdcdata-fnam = fnam.
gt_bdcdata-fval = fval.
APPEND gt_bdcdata.
ENDFORM. "BDC_FIELD
*& Form delete_headerinfo
text
--> p1 text
<-- p2 text
FORM delete_headerinfo .
DELETE gt_data INDEX 1.
ENDFORM. " delete_headerinfo
FLAT FILE
*MATERIAL NUMBER INDUSTRY SECTOR MATERIAL TYPE BASE UNIT OF
*MEASURE MATERIAL DESCRIPTION
*806 M FERT CM IRON
*807 M HALB KG STEEL
*808 M HAWA KG IRON
Reward points if helpful
Kiran Kumar.G.A
Have a nice day... -
Stuck - load the Excel file dynamically with different columns and worksheet names
I have a situation where I want to load the Excel file dynamically, and the excel file have different columns or even worksheet name. Any idea how I could
approach this? I believe there's no way to modify the meta data (specifically the mapping) in the data flow.Hi Chimumu,
The SSIS stock adapters don't supporting dynamic column mapping, to achieve your goal, you need to use Script Task/Component to read the Excel sheet name and the columns in the worksheet, and then map to the output columns of the script component. You can
also refer to the following blogs:
http://micktechblog.blogspot.com/2011/06/ssis-excel-import-with-unknown-number.html
http://wikiprogrammer.wordpress.com/2011/04/08/dynamic-column-mapping-in-ssis-part-1/
Regards,
Mike Yin
TechNet Community Support -
FROM EXCEL FILE TO INTERNAL TABLE
HI GURU'S,
i'm using the following code to conver the excel file into internal table.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR = 'X'
I_LINE_HEADER =
I_TAB_RAW_DATA = IT_TAB_RAW_DATA
I_FILENAME = P_FILE
TABLES
I_TAB_CONVERTED_DATA = IT_MM01
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
What is the exact format for the to send the Excel File.
My requirement is the Excel file contains the several fields , that should be stored as a records in the internal table
My problem is when i send the data in the excel file as one column, i'm getting all the data in the first column of the Internal Table.
If i send the data in the excel file as a record it is not filling the internal table.
what is the problem??/
if the Excel files contain multiple records is it able to convert the data into internal table records.
Regards,
Adi.**Internal Table to hold the records in the text file
Hello Adi,
Put the fields in excel in the same format in which u want in ur internal table(here record)
U can refer the following code.
data: begin of record occurs 0,
General Data
data element: BUKRS
bukrs_001(004), " Company Code
data element: EKORG
ekorg_002(004), " Purchase Orgn
data element: KTOKK
ktokk_003(004), " Account Group
end of record.
Internal Table
data:it_excel like table of alsmex_tabline with header line.
**SELECTION-SCREEN**
selection-screen begin of block blk.
parameters: p_file like rlgrap-filename default 'c:\vendor_creation.xls'
selection-screen end of block blk.
A T S E L E C T I O N - S C R E E N O U T P U T
***************START*********************** F4 Help for field p_file
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
changing
file_name = p_file
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
if sy-subrc <> 0.
message e006(zhnc).
endif.
S T A R T - O F - S E L E C T I O N
start-of-selection.
data : vf_index type i.
data : vf_start_col type i value '1', "start column
vf_start_row type i value '4', "start row
vf_end_col type i value '200', "maximum column
vf_end_row type i value '2500', "maximum row
p_text(20). "stores error messages
*/ Work Area
data: wa_intern like it_excel.
*/ Field symbol
field-symbols : <fs>.
*********Fn Module to convert the excel file data into internal table
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = 'c:\vendor_creation.xls'
i_begin_col = vf_start_col
i_begin_row = vf_start_row
i_end_col = vf_end_col
i_end_row = vf_end_row
tables
intern = it_excel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if it_excel[] is initial.
p_text = 'No Data Uploaded'.
else.
sort it_excel by row col.
loop at it_excel.
move : it_excel-col to vf_index.
assign component vf_index of structure record to <fs>.
move : it_excel-value to <fs>.
at end of row.
append record.
clear record.
endat.
endloop.
endif.
In case of any problem u can revert back.
Aastha -
Incorrect format in Excel file
I have 2 columns in a table -
Column C1 is a varchar2 with values like -ABC, -MNO etc i.e. every value has a '-' as the first character.
Column C2 is a number column.
Through a procedure, I send them to Excel file but the column C2 is displayed as text column left aligned. How do I get it as a number column in the Excel file? It happens due to the '-' in the first column.What is the purpose of the - character? I don't understand why Excel thinks c2 is not a number field, if it contains values like -111. A .CSV with a column of negative numbers would open up in the general number format.
Through a procedureWhat sort of procedure? Something using SYLK? Or some other PL/SQL API?Or a Stored Java Procedure? Or UTL_FILE to write a .CSV file?
Honestly I don't know how you expect us to solve your problem when you give us so little to go on.
Regards, APC -
Excel Upload with Hidden Column
Hi Gurus-
Can you upload Excel file with hidden column and get the function to read values in hidden column? If yes, could you please guide me how?
I am using ALSM_EXCEL_TO_INTERNAL_TABLE
Any help will be highly appreciated.
Thanks in advance!Hi,
Have a look at program RSDEMO01 (available in the controls examples of the workbench). It demonstrates an OLE connection to Excel.
To know which excel objects, methods and properties to use it is a good idea to use the excel macro recorder - just do what you want your program to do and then translate the resulting VB code to ABAP OLE.
For the import of the clipboard data you can use CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT. In the result table, iirc, there is one line for each imported line and within the line the cell values are separated by tab. So there is some work left - it might be a good idea t import the data column by column.
It has been some time when I did this for a former client of me - so unfortunately I do not have the code any more.
Regards, Gerd Rother -
Reading long text from excel file to an internal table
Hi
Can any body tell me how to read long text from excel file to an internal table.
When i am using this FM KCD_EXCEL_OLE_TO_INT_CONVERT then it is reading only 32 characters from each cell.
But in my excel sheet in one of the cell has very long text which i need to upload into a internal table.
may i know which FM or what logic i need to use for this problem.
RegardsHi,
Here is an example program. It will upload an Excel file with two columns. You could also assign the Excel structure dynamically, but I wanted to keep the example simple. The main point is that the internal table (it_excel in this example) must match the Excel structure that you want to convert.
Remember, this is just an example to help you figure out how to properly use the technique. It will certainly need to be modified to fit your requirements, and as always there may be a better way to get the Excel converted... this is just one possibility that has worked for me in the past.
*& Report zexcel_upload_test *
REPORT zexcel_upload_test.
TYPE-POOLS: truxs.
TYPES: BEGIN OF ty_excel,
col_a(10) TYPE n,
col_b(35) TYPE c,
END OF ty_excel.
DATA: l_data_tab TYPE TABLE OF string,
l_text_data TYPE truxs_t_text_data,
l_gui_filename TYPE string,
it_excel TYPE TABLE OF ty_excel.
FIELD-SYMBOLS: <wa_excel> TYPE ty_excel.
PARAMETERS: p_file TYPE rlgrap-filename.
* Pass the file name in the correct format
l_gui_filename = p_file.
* Upload data from PC
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_gui_filename
filetype = 'ASC'
has_field_separator = 'X'
CHANGING
data_tab = l_data_tab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
* MESSAGE ...
EXIT.
ENDIF.
* Convert from Excel into the appropriate itab
l_text_data[] = l_data_tab[].
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = l_text_data
i_filename = p_file
TABLES
i_tab_converted_data = it_excel
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ...
EXIT.
ENDIF.
LOOP AT it_excel ASSIGNING <wa_excel>.
* Do something here...
ENDLOOP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM filename_get CHANGING p_file.
* FORM filename_get *
FORM filename_get CHANGING p_in_file TYPE rlgrap-filename.
DATA: l_in_file TYPE string,
l_filetab TYPE filetable,
wa_filetab TYPE LINE OF filetable,
l_rc TYPE i,
l_action TYPE i,
l_init_dir TYPE string.
* Set the initial directory to whatever you want it to be
l_init_dir = 'C:\'.
* Call the file open dialog without multiselect
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Load file'
default_extension = '.XLS'
default_filename = l_in_file
initial_directory = l_init_dir
multiselection = 'X'
CHANGING
file_table = l_filetab
rc = l_rc
user_action = l_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
REFRESH l_filetab.
ENDIF.
* Read the selected filename
READ TABLE l_filetab INTO wa_filetab INDEX 1.
IF sy-subrc = 0.
p_in_file = wa_filetab-filename.
ENDIF.
ENDFORM. " filename_get
Regards,
Jamie -
Any way to export table to excel file with leading 0s?
I have to export about 50 excel files from different tables. Some tables contain leading 0s in the columns. If I use bcp to export to xls file, the leading 0s will be missing. If bcp to csv or txt file, there will be no issue at all. But I have to export to xls file in order to let client update that xls file and reload to tables again.
Is there any other ways to do this task?
Thanks in advance.Ok, I played with it and fixed it on mine to work.
Here is what you do. Create a blank Excel file in Excel with a single header row with your column names in it, and then set the datatypes for each column in Excel to match your export type. For the below, create an Excel file and in column A1, put "Name" and change the column to Type Text. Then in B1 type Date and set it to type Date, then save the file as c:\Test.xls. Then close the file in Excel.
In SSMS execute the following:
Code Snippet
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\test.xls;HDR=YES',
'SELECT Name, Date FROM [Sheet1$]')
SELECT [Name], GETDATE() FROM msdb.dbo.sysjobs
GO
It worked perfectly in my environment. Don't bother with BCP, just create a formated Excel File with a header row with your output column names and then save it. -
Reading contents of uploaded excel file in web dynpro java
Hi All.
I am aware how to provide facility to upload files in web dynpro java. But my requirement is that on uploading a particular file (for eg. an excel file having 10 columns), I need to read the contents of that file and store it in a table in R/3.Can anyone suggest a way how I can read the contents of the uploaded file?
Thanks and Regards,
Saurabh.Hi.
I am having the following requirement : I have a FileUpload UI element where user clicks Browse button, selects a file from the local system and presses a Upload button. Upon pressing Upload, the name of the selected file and the contents of the file should be shown.
In the View context, I have two value attributes: FileName of type String and FileResource of type binary.
This is the code that I have in the Upload button action handler :
public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload(ServerEvent)
IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(
IPrivateReadExcelView.IContextElement.FILE_RESOURCE);
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attributeInfo.
getModifiableSimpleType();
IPrivateReadExcelView.IContextElement element = wdContext.createContextElement();
String fname = binaryType.getFileName();
wdComponentAPI.getMessageManager().reportSuccess("File selected - "+fname); //Statement 1
try {
wdComponentAPI.getMessageManager().reportSuccess("Successful"); // Statement 2
InputStream in = new FileInputStream(fname);
HSSFWorkbook wb = new HSSFWorkbook(in);
wdComponentAPI.getMessageManager().reportSuccess("Successful"); //Statement 3
int sheetsNo = wb.getNumberOfSheets();
for (int i=0;i<sheetsNo;i++) {
HSSFSheet sheet = wb.getSheetAt(i);
Iterator rowsNo = sheet.rowIterator();
while(rowsNo.hasNext()) {
HSSFRow rows = (HSSFRow)rowsNo.next();
Iterator colsNo = rows.cellIterator();
while(colsNo.hasNext()) {
HSSFCell cell = (HSSFCell)colsNo.next();
wdComponentAPI.getMessageManager().reportSuccess("File uploaded" +
"successfully");
if(cell.getCellType()==1) {
wdComponentAPI.getMessageManager().reportSuccess("00000"+
cell.getStringCellValue());
else if(cell.getCellType()==0) {
String str=""+cell.getNumericCellValue();
wdComponentAPI.getMessageManager().reportSuccess("11111"+str);
catch(Exception e) { wdComponentAPI.getMessageManager().raisePendingException();
//@@end
On pressing Upload button, name of selected file is being shown(Statement 1). I am also getting Statement 2 in the output. However I am not getting Statement 3 onwards.
Where am I going wrong? Can anyone shed some light on this?
Maybe you are looking for
-
Cannot install iTunes 10.7 on snow leopard MacBook Pro.
I have received my new iPhone 5 two weeks ago but I am unable to use it since I cannot install iTunes 10.7. I have a MacBook Pro with Mac OS 10.6 (snow leopard) and 2GB RAM. I have been trying to install it and every time I get an error message sayin
-
Mail not working at my workplace
I've never had trouble getting my email accounts mail (gmail, aol, me.com, etc) from work or home but now all of the sudden, I'm unable to send mail through my Apple Mail program at work. Here's the facts: -connected with ethernet cable (not wireless
-
OBI-ODI lineage:Unable to unarchive odi_catalog_archive.cat
Hi, Our requirement is to implement OBI-ODI lineage. I followed the link: http://www.oracle.com/technology/obe/fusion_middleware/ODI/OBI-ODI_Lineage/OBI-ODI_Lineage.htm. The problem we are facing is at the step of unarchiving the odi_catalog_archive.
-
WRT54G + Speedtouch W'less pc card
Right, first of all : Hello! I am a statisfied linksys customer and (untill recently) never had any problems with linksys products. However, I'm having strange problems asof lately. Somehow i cant connect to router (Linksys WRT54G) wireless, but i ca
-
Stuck between countries with regards to AppleCare+
I recently purchased an unlocked iPhone 6 in Canada. I spend about half of my year in Canada and half in Ireland. I got AppleCare+ with my iPhone as extra insurance in case I ever ran into trouble. Unfortunately, I ended up cracking my phone's screen