Connecting To A .CSV or Excel File Directly With LightSwitch
Despite my zipcodes.csv file is already present in the debug folder of my project, still my code is not able to find the file.
Regards,
Vishal
When you run the code in debug mode you can place a break point at the point where the code is trying to pick up the file and see what path it expects the file to be at.
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
http://LightSwitchHelpWebsite.com
Similar Messages
-
How to connect XLSX(MS Office 2007 Excel file) in java
i successfully connected ms office 2003 *.xls* file with the help of JXL library
can any one tell me how can i connect XLSX (MS Office 2007 Excel file) in java.http://www.smartxls.com/indexj.htm is commercial library (not free) also a poor documentation
can you give me a sample code of reading and writing xlsx file
http://poi.apache.org/spreadsheet/index.html free library.
but sample code are difficult to understand .
if you have a good and simple example code please give me OR any other reffrences -
Macro to compare CSV and Excel file
Team,
Do we have any macro to compare CSV and Excel file.
1) In Excel we should have two text boxes asking the user to select the files from the path where they have Stored
2) First Text is for CSV file
3) Second Text box is for Excel file
4) We Should have Compare button that should run the Macro and Show the Differences.
Thanks!
KiranHi
Based on my understanding, we need to convert the 2 files into the same format before comparing two different formats files.
Here are the options:
1. Convert the CSV file and Excel file into 2-dim Arrays, then compare them, about how to load a CSV file into VBA array, you can search it from
internet or ask a solution in VBA forum.
VBA forum:
http://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
2. Also you can import CSV file to Excel sheet, and then compare them.
Here is the sample code for your reference:
‘import csv file
Sub InputCSV()
Dim Wb As Workbook
Dim Arr
Set Wb = GetObject(Application.GetOpenFilename("csv file,*.csv", , "please choose a csv file", , False))
Arr = Wb.ActiveSheet.Range("A1").CurrentRegion
Wb.Close False
Range("A1").Resize(UBound(Arr), UBound(Arr, 2)) = Arr
End Sub
‘compare sheet
Sub CompareTable()
Dim tem, tem1 As String
Dim text1, text2 As String
Dim i As Integer, hang1 As Long, hang2 As Long, lie As Long, maxhang As Long, maxlie As Long
Sheets("Sheet1").Select
Columns("A:A").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("A1").Select
Sheets("Sheet2").Select
Rows("1:4").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("A1").Select
MaxRow = 250
MaxColumn = 40
For hang1 = 2 To maxhang
Dim a As Integer
a = 0
tem = Sheets(1).Cells(hang1, 1)
For hang2 = 1 To maxhang
tem1 = Sheets(2).Cells(hang2, 1)
If tem1 = tem Then
a = 1
Sheets(2).Cells(hang2, 1).Interior.ColorIndex = 6
For lie = 1 To maxlie
text1 = Sheets(1).Cells(hang1, lie)
text2 = Sheets(2).Cells(hang2, lie)
If text1 <> text2 Then
Sheets(2).Cells(hang2, lie).Interior.ColorIndex = 8
End If
Next
End If
Next
If a = 0 Then
Sheets(1).Cells(hang1, 1).Interior.ColorIndex = 5
End If
Next
Hope this will help.
Best Regards
Lan
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Distinguishing between CSV and Excel file formats
I am trying to distinguish between CSV and Excel files. Most of the files I need to process are CSV, but some have been opened and re-saved in Excel format. I know about the Excel toolbox available, but haven't used it yet.
I need to be able to open a spreadsheet file regardless of if it is in CSV or Excel format. Any help would be greatly appreciated.
Here are two example files, one CSV and one Excel. Both have .XLS file extensions.
Attachments:
20-4-XLS.xls 21 KB
20-5-CSV.xls 8 KBHi Paul,
I think the matter is not the extention (xls or csv or whatever) but the format of the data written in your file.
To see what I mean, open the xls file you posted with notepad... What does it look like ?
You have tobe sure of the format of the file you want to read so that you can develop an appropriate VI... if you want to be able to read different type of data format, do a test before reading the file and then use an appropriate routine for each format.
Hope this helps you...
BTW, to read the one named CSV, a simple "read from spreadsheet file" VI will do the job
When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!" -
Best way to transfer csv or excel file ??
Hi
Can anyone recommend the best way for a customer emailing a csv or excel file to me - how can i guarantee it came from them and hasn't been tampered with. This file is generated from the application i develped if this helps.
Have looked at public private keys and signatures etc,
Thx
Stephen1. your customer should have generated a key pair (public/private).
2. you should have a copy of his public key.
3. the customer creates a hash (using MD5 for example) from the file he wants to send.
4. the customer encrypts the resulting hash with his secret key (this is a signature).
5. the customer sends the file and the encrypted hash.
After you receive both files:
1. you create a hash from the excel file received (using the same algorithm the customer used to create the hash).
2. you decrypt the encrypted hash the customer sent.
3. you compare both hashes, if both are the same, then the excel file you received is Ok = has not been tampered.
Hope this helps. -
FM to down load the spool to excel file along with the deliminator
hi all,
this is regarding a downloading of spool to a excel file along with a deliminator.
Can any one suggest a function module which downloads spool to excel file with a deliminator in a proper way.Hi ram,
You can try using the BAPI_XBP_JOB_SPOOLLIST_READ_20 - to get the list from spool and then do the required formatting. You can use can use the function module mentioned in the other reply to download it into excel file.
Cheers -
Hi guys,
I got a problem with my Office 365 that every time I open an office file from IE/chrome browser (i.e. click the document link and save the file to local, open it in the browser after download completed) or under a zip file, no matter it is an excel file
or word document, the Excel/Word crashes. The Excel/Word will ask me to repair the file if I open the file again. The file will be closed automatically after the repair, when I open the file again it will told me the excel/word itself has just successfully
registered and ask me to close and re-open the excel again in order to enable editing the file. This is extremely inconvenience, I have to open this file 4 times to edit my file.
Could anyone here can help me to resolve the problem?
Many thanks.Hi,
According to your description, Excel seems not crash when you opened a local Excel/Word file directly. Where do you store these file? OneDrive, SharePoint or other?
If possible, please let me see the screenshot of the error dialog.
Moreover, please open Event Viewer to check whether there's any error about the Excel/Word crash issue.
Press Win + R, type "eventvwr" in the blank box, press Enter. In the Event Viewer, browse to Windows Logs -> Application, there may be some errors after the crash.
To protect your privacy, you may send the error logs to
[email protected], we will try to find the cause.
Regards,
George Zhao
Forum Support
Come back and mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback on our support, please click "[email protected]" -
Save alv report as excel file directly from program
Hello guys,
I require this in my work.
I want to save the ALV report tat is to be generated in the filepath that is given in the selection screen (want to save it locally eg: my windows desktop) and in the layout which is also given in the selection screen.
your comments will be very much appreciated.
Thanks in Advance,
JohnyHi Johny,
Actually we have an option to download report output in ALV but it does not download the specified on Selection-screen. For this Create on button for Excell download by setting PF status. and use USER_COMMAND event to trigger when u click on the button and download data to specified path.
1.
declare events table like this.
data :
i_events type slis_t_event,
w_events like line of i_events.
2.
Build events table .
w_events-name = 'USER_COMMAND' .
w_events-form = 'USER_COMMAND' .
append w_events to i_events.
clear w_events.
w_events-name = 'PF_STATUS_SET' .
w_events-form = 'PF_STATUS_SET' .
append w_events to i_events.
clear w_events.
3.
pass this events table through REUSE_ALV_GRID_DISPLAY.
4.
USER_COMMAND and PF_STATUS_SET call back subroutines should be like this in your case. These are nowhere called using PERFORM statement in ur program.
5.
PF_STATUS_SET' subroutine should be like this.
*& Form pf_status_set
form pf_status_set using extab type slis_t_extab.
set pf-status 'STATUS1' excluding g_extab.
"If you write like above Standard status will be gone.
"For that u have to copy standard status of any ALV program which has standard status.
"1. goto SE41 tcode. give program SAPLKKBL and status :STANDARD_FULLSCREEN .
2.Click on the Copy status button below program is ur program and status ur program status.
3. After that create your own button for Excel downlod.
endform. "pf_status_set
6.
USER_COMMAND subroutine should be like this.
*& Form user_command
form user_command using ucomm like sy-ucomm
selfield type slis_selfield.
case ucomm .
when 'XLS_DOWN'.
perform download_to_xls.
endcase.
endform. "user_command
Here is the sample program to download data into Excel file with header and Columns..
Check this program by running.
*& Report ZVENKAT_DOWNLOAD_XLS_WITH_HEAD
REPORT zvenkat_download_xls_with_head.
" Data retrieval related declarations
TYPES:
BEGIN OF t_emp_dat,
pernr TYPE pa0001-pernr,
persg TYPE pa0001-persg,
persk TYPE pa0001-persk,
plans TYPE pa0001-plans,
stell TYPE pa0001-stell,
END OF t_emp_dat,
t_attachment TYPE solisti1.
DATA:
w_emp_data TYPE t_emp_dat,
w_attachment TYPE t_attachment.
DATA:
i_emp_data TYPE STANDARD TABLE OF t_emp_dat,
i_attachment TYPE STANDARD TABLE OF t_attachment.
PARAMETERS: p_file TYPE string DEFAULT 'c:\tmp\test.xls'.
"Start-of-selection.
START-OF-SELECTION.
PERFORM get_data.
PERFORM build_xls_data_and_download.
"Form get_data from PA0001
FORM get_data.
SELECT pernr
persg
persk
plans
stell
FROM pa0001
INTO CORRESPONDING FIELDS OF TABLE i_emp_data
UP TO 4 ROWS.
ENDFORM. " get_data
"Form build_xls_data_and_download
FORM build_xls_data_and_download.
"If you have Unicode check active in program attributes then
"you will need to declare constants as follows.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:
con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
DATA :l_lines TYPE char10.
DESCRIBE TABLE i_emp_data LINES l_lines.
CONCATENATE 'Total no of records:' l_lines
INTO w_attachment
SEPARATED BY con_tab.
CONCATENATE con_cret
w_attachment
INTO w_attachment.
APPEND w_attachment TO i_attachment.
CLEAR w_attachment.
CONCATENATE 'PERNR' 'PERSG' 'PERSK' 'PLANS' 'STELL'
INTO w_attachment
SEPARATED BY con_tab.
CONCATENATE con_cret
w_attachment
INTO w_attachment.
APPEND w_attachment TO i_attachment.
CLEAR w_attachment.
LOOP AT i_emp_data INTO w_emp_data.
CONCATENATE w_emp_data-pernr
w_emp_data-persg
w_emp_data-persk
w_emp_data-plans
w_emp_data-stell
INTO w_attachment
SEPARATED BY con_tab.
CONCATENATE con_cret w_attachment
INTO w_attachment.
APPEND w_attachment TO i_attachment.
CLEAR w_attachment.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
write_field_separator = con_tab
TABLES
data_tab = i_attachment.
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. "build_xls_data_and_download
I hope that it helps u .
Regards,
Venkat.O -
Upload Excel File : Problem with Filter
Hi Experts,
by using "TMP_GUI_FILE_OPEN_DIALOG" with these parameters:
window_title = 'Please select an Excel File'
default_extension = '*.xls'
file_filter = '*.xls'
multiselection = ' '
init_directory = 'C:\temp'
it doesn't show any file the first time we call the Function, we have to close the window and then restart the Function Then it show all Fileformat, I just want to see .XLSX files.
Any idea?
Regards,
DavidI found the solution:
Initialisierung
CONCATENATE 'Alle-Dateien(.)|.|'
'Word-Dateien(.doc)|.doc|'
'Bild-Dateien(.gif)|.gif|'
'Bild-Dateien(.jpg)|.jpg|'
'Mail-Dateien(.msg)|.msg|'
'PDF-Dateien(.pdf)|.pdf|'
'Bild-Dateien(.tif)|.tif|'
'Text-Dateien(.txt)|.txt|'
'Excel-Dateien(.xls)|.xls'
INTO filter.
Datei abfragen
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Datei auswählen'
file_filter = filter
initial_directory = 'C:'
CHANGING
file_table = i_file[]
rc = rcode
EXCEPTIONS
OTHERS = 1.
Regards,
David -
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 -
Importing excel files - problem with single quote
When importing excel files using 1.5, I can't get data with single quotes (') imported.
When I run the insert statement given in SQLPlus I get "ORA-01756: quoted string not properly terminated", which is different than the error that SQL Developer gives me (see below).
Also, I have a numeric value shown without a thousands comma-separator in the XLS file that I'm trying to load into a varchar2 field. But, the insert statements have added a thousands comma-separator which I don't want.
REM Error starting at line 1 in command:
REM INSERT INTO table (ID, NAME, CODE)
REM VALUES (2427407, 'Ed-u-care Children's Center', '73,000');
REM Error at Command Line:2 Column:37
REM Error report:
REM SQL Error: ORA-00917: missing comma
REM 00917. 00000 - "missing comma"
REM *Cause:
REM *Action:
One last thing, TOAD gives a way to automap columns chosen from XLS to the columns in the database. It sure would be nice to have this functionality in SQL Developer.
Thanks,
SteveDid you consider both to be bugs (i.e., single quote issue and thousands comma separator issue)?
Thanks -
ABAP solution to read data from excel file attached with project document
i have a project created through tcode cj20n and attach an excel file with it. now my objective is to read the contents of that attach file through abap. can any one please help me in this matter? how can i know the path of that file?
Hi,
you can't do it in 30 minutes if you never did before.
Use[ DOI |http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf]
Regards,
Clemens -
How to attach a word or excel file directly in Email App on iPhone 5s
The biggest disappointment for me with iOS7 is the inability to attach word, excel and pdf documents directly to a mail in the Mail App instead of attaching them from the app you are using at the time. This is a serious flaw and Apple must by now know that attaching video and pictures is not all that users of their devices do. Surely they need to take this aspect seriously if they want to be taken seriously by business customers!
HI,
This is quite possible.
Actually, before approving or rejecting, the manager has to get email from other approvers who dont have access to SAP or Portal.
How these approvers are notified about workitem?
However, you can make use of decision step to approve or reject.
When Manager will open the work item ,SAP standard functionality can be used to attach file , here manager can select word file format and attach the required file. then he can approve or reject it.
This file would be saved as instance of SOFM object and a background method would be required if you want to read the contents.
Regards,
Sangvir Singh -
To upload excel file directly to the application server using OLE concept
hi experts
i have done a coding in OLE to download excel with graph to presentation server, is it possible to upload excel with graph directly to the application server , the excel should have graph while downloading to presentation server fom app server.
Moderator message - duplicate post locked
Edited by: Rob Burbank on Jun 25, 2009 9:49 AMHI,
have a look at tcode cg3z and then FM 'C13Z_FILE_UPLOAD_ASCII'.
What you can do is, first create the file on presentation server using OLE automation, and then using this FM, write the file to Application server -
Is there a way to export a group of contacts from "Contacts" to an CSV or Excel file?
Is there a way to export a group of contacts from "Contacts" to an Excel or CSV file?
Christine fm STL wrote:
Is there a way to export a group of contacts from "Contacts" to an Excel or CSV file?
I urge you to look at AB2CSV
Easily choose a group, all groups or all cards to export.
Complete control over what is exported and what is the delimiter.
And it's free.
Maybe you are looking for
-
I just purchased ADOBE PHOTOSHOP CS2 'Classroom in a Book'
When I received the 'used' book yesterday in the mail, I was dismayed to discover that the lesson CD was missing. Anybody have any thoughts on how I can get a copy of the CD or download the lessons from someplace. Thus far I haven't heard back from t
-
Hi is there any XMLDocument data type available in SOAP libraries
How to convert string to XML Document data type and is there any XML Document type available in SOAP Libraries&j2ee api?
-
I am unable to charge my iPod touch at all. I have tried several different USB cables and none work. I am also unable to sync my iPod with iTunes and back up my purchases. What do I do? I could by another I pod but I don't want to lose everything I h
-
Does anyone know if you can change the keyboard to allow for accents used in Spanish?
-
COPA actual data postings into new server.
Dear Experts, I would like to say thanks before update my problem. we have existing server and transactions posted since four years. we have total 24 company codes into one controlling area and one operating concern. Now the business requirement is t