As I know How to import csv file into Progress database, I would like to know the sample script to import xls file into progress database.
please advise me.
There are many different XLS compatible formats. CSV or TAB delimited are two very easy ones to work with. The newer formats are complex, compressed XML archives.
CSV and TAB and the ilk are easy. Just use IMPORT DELIMITER.
Example using a semicolon (;) separated file (normally with extension.csv).
/* Fields in temp-table matches the columns of the .csv-file */
DEFINE TEMP-TABLE ttExample NO-UNDO
FIELD col1 AS CHARACTER
FIELD col2 AS INTEGER
FIELD col3 AS DATE.
INPUT FROM c:\temp\test.csv.
REPEAT:
CREATE ttExample.
IMPORT DELIMITER ";" ttExample.
END.
INPUT CLOSE.
There are also some older formats like SYLK. There is an import for that hanging somewhere off the data dictionary tools if I recall.
Excel also deals well with HTML tables. A fragment of HTML consisting of tags is easily imported by Excel.
The newer .xlsx formats have no direct Progress 4GL import available and you would need to first research and specify the details of the format you are using. First you will need to uncompress. Then you need to handle the XML inside.
IMPORT DELIMITER "," /* field list here */.
Related
I try to import a CSV-file in Excel. The program has funny default properties. It puts the content of the rows all in one column including the commas. Lets say the file content is (test.csv):
1, 2, 3
4, 5, 6
What I expect Excel to do is to put each number into a separate field using the comma as separators. However, the excel table has only two fields each containing 3 numbers including the commas, something like this (not what I want):
"1, 2, 3"
"4, 5, 6"
What do I have to change in Excel settings so that it does this standard task correctly?
You are probably not importing the CSV but instead opening it either double clicking or using the open dialog.
One of the correct ways of importing a CSV into Excel is using Data | From Text/CSV menu. This way you will be able to select the delimiters, change data types if you need etc.
Importing CSV via Data | From Text is -- altough working -- rather cumbersome: You need to select the file, the wizard asks about "Delimited" or "Fixed width", then you need to select "Comma" as seperator and finally how to import the data. And when you want to reimport later on the whole procedure starts again and again and again ..
Instead use Data | New Query | From File | From CSV and select the file to import from. I still had to adjust the encoding to UTF-8 while other settings are correctly detected (delimited by comma).
The really great advantage is that you have to do this only once as the above procedure creates a so called "workbook query". To update or reimport just click "Refresh" in the workbook query's context menu.
Depending of the configuration of Excel, the CSV files can be separated with "," or ";". To open a CSV file it's better to go to file-->open file-->text. There Excel asks you for the way you want to separate your fields in CSV.
Regards
I am saving currencies (decimal values) in my CSV file that the customer wants to open in Excel. However, Excel formats those currency values to dates, if the range allows to (day <= 31, ...).
I found many hacks, that kind of get around it, but none that meets all of the following 3 requirements:
Should work with American and German settings (comma vs. decimal point)
Sums over those columns should be possible
Amounts smaller than 31.12€ should be possible
Things I have tried:
use "=""04.06"
use '04.06
use 04.06\t
Thanks for your help.
I am using NodeJS to automatically generate the csv files on click of a button.
Here is a sample CSV File (I don't know how to upload it here as file):
Passenger Number;Name;Birth Date;Int. Fares;Int. Taxes;Dom. Fares;Dom. Taxes
ARB1234;Max/Meister;12.04.2001;4.03;2.06;3;110
The most stable solution for this problem is to Import the file. If you Open the file, Excel makes a bunch of assumptions that may be incorrect (as you have noted). If you Import the file, you can intervene and declare, for example, the delimiter (semi-colon in this case); the date format (I used MDY but DMY could be used instead) and which column you want formatted as a date; and even the decimal and digit separators.
The manner in which to call the Import varies in different versions of Excel. I show below the method for 2016. From Text/CSV may open Get & Transform with an opportunity to select the file. Or, if you prefer the Legacy wizards, those can be made accessible under the Get Data tab.
The legacy method opens the Text Import Wizard. The more recent method allows you to set up a refreshable data connection to the file, and may be preferable for your end-user, as he will not have to fill in the options each time.
I'm using Matlab to output some CSV files.
dlmwrite('filename.csv', DataX, '-append');
which gives me pretty CSV values such as
368,331,368,301,293,323,308
210,766,97,105,82,90,82,97
(rows and columns truncated, it's about 20*50)
When i import this into Excel it will read this in as
3.68331368301293E+167
210,766,97,105,82,90,82,97
Where it reads in the data as scientific notation, it also removes those values it deems non-significant, resulting in a few significant digits and about 150 zeroes. How can i prevent excel from randomly deciding something is or isn't scientific notation?
Most likely you are not importing the file but rather you are opening the file. If you import the file the text import wizard will open, and you will be able to define the comma as the delimiter.
In early versions of Excel, this is a drop down next to the file open button. In recent versions of Excel, you select the Get External Data tab on the Data Ribbon, and select the From Text button.
This is the content of the excel file:
"Windows Excel","AndroMoney","20140227"
"Id","Valuta","Importo","Categoria","Sottocategoria","Data","Spese(Trasferimento Out)","Entrate(Trasferimento In)","Note","Periodicita'","Progetto","Pagatore/Beneficiario","uid"
"19","EUR","-1079.63","SYSTEM","INIT_AMOUNT","10100101","","Bank","","","","","116EUR-1079.63_26_102"
"20","EUR","-2662.9","SYSTEM","INIT_AMOUNT","10100101","","Credit Card","","","","","117EUR-2662.9_26_102"
"960","EUR","0","SYSTEM","INIT_AMOUNT","10100101","","Bank austria","","","","","265C6BD548CE41FEA0250BF4E19C392F"
"1","EUR","8","Food","Breakfast","20130326","Cash","","","","","","1EUR8_1_1"
And here is how Excel shows its content:
In another post they say it's due to the usage of the , instead of ;
Is it possible to solve the problem without changing Operating System settings?
You can select column A and go to Data - Text to Columns. Then use delimited and define , as the delimiter. This will delimit the data and show it correctly.
If you're asking how to make it delimit based on the comma when you open it, I didn't read the question that way. But instead of double-clicking the file to open, go to the Data tab and Get External Data from it, defining the delimiter.
I use a trick.
Change the extencion from CSV to TXT, the open the file with excel, define , as the delimitator character
In Excel 2010 and newer csv files are read correctly. In older versions you need to specify a separator during import in text import wizard.
I have a CSV file like this:
"Foo","Bar","16/5"
Open it with Excel and it decides the the "16/5" is a date and displays 16 May, but I just want it to display the string verbatim on loading the CSV without having to perform any additional actions in Excel and I'm not sure how to achieve this unless I put some white space at the start of the string but that's nasty.
Use the Text Import Wizard - you can assign specific data types to each column as needed.
http://office.microsoft.com/en-us/excel-help/text-import-wizard-HP010102244.aspx