Convert text file to table on Import
We have a lot of tables, that we'd like to maintain outside of FrameMaker (we're using FM9). I've been trying to figure out the best way to do it, and using the Import>File>Convert option seems like the best.
However, my question is what is best practice for the type of files we use? At first it seemed like using Excel and saving as a .csv or tab-delimited text file would be easiest. But there doesn't seem to be a .csv convert option and setting "," as the delimiter means we can't use commas inside the cell content. And it seems to import tab-delimited cells that contain a comma inside quotes.
It seems like the other option would be to use HTML for the table content. We are new to all this stuff, so using HTML would add to the learning curve, but I can push it through if it's best practice/will make the cleanest conversions. Or is there a way to use Excel that converts cleanly that I just haven't figured out?
Any thoughts would be appreciated!
Last year, based upon a comment on this forum, I imported an Excel table into a structured FrameMaker document by copy. FrameMaker created the table and applied its own version of a structure. For example, row elements were named ROW, cell elements were named CELL, etc. Because my table structure used different names, I had to change them to make the structure valid. There may have been some subtle issues with the table element itself. It was not clean but it got the job done.
Regarding Michael's suggestion about XML, I DID try this once, and it worked fine. The exported XML from Excel was simple and clean. The XSLT was therefore easy to write. If you have lots of tables to do, this might be the best way to go. It may take some work to get it working correctly, but once it is, subsequent work will be minimized.
Regarding XML from Excel, I was using the old Excel format xls. I have not worked with the newer xlsx format, which IS based upon XML. If you are using xlsx, I would be sure to export as XML and not "save" as XML (not sure what the command would be) in order to avoid getting all the XML used in newer Excel to store formatting and other meta information.
Good luck.
Similar Messages
-
Hi,
I need to Convert a text file in a specific format to table.
Please find the attachment for the text file.
the table contains columns Section, Address, Data, Attribute.
Anybody please share me a sample VI to implement the above.
-mfp.
Attachments:
ADC1.txt 1 KBPlease try to understand what smercurio told you : We can help you learn how to use LabVIEW, but we are not here to help you do your home work.
If you want help, you should show us what you have attempted yet : attach an example of your code. This will help us understand where you are stuck. If you don't, you will send us a very strong negative message.
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
Convert data in the text file to table in DBL
Hi guys
I wanted to convert data in text file which are in multiple rows and columns in DBL format to a table to b seen in labview as DBL format.
I had tried looking and working at the example but in vain , i just cant produce anything
pls help. or write me a short example..thanksAre you dealing with a table or an array. For an array, just use the Read spreadsheet file from the File I/O palette.
For a table, you will have to convert the number to a string and setting the appropriate precision and width, then write the 2-D string array to the table.
Message Edited by Ravens Fan on 05-20-2008 11:54 PM
Attachments:
Example_VI_BD6.png 3 KB -
Importing text file into table
hello
i have a text file which contains data like empno,date and one character . every day this file is updated with new records.
now i want this data to get inserted to a table, whenever new record has been appended to the text file
can i have query or some way to do this. i can do it through sql loader, but i will not have info when the data is appended to the text file.
pls help
thanks in advance
sdsreenivasIf you're on 8.0.3 (which has been desupported for a number of years), then SQL*Loader strikes me as your best option. You could write a batch process that re-loads the file periodically so you see changes or you could write a batch file that polls the timestamp for the file and calls SQL*Loader whenever it is updated.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How to get current month from filename and bulk insert from text file into table?
I set up some dynamic SQL to help my bulk copy data from a text file to a table. This works fine for files that come in every day; I get the previous day’s data, based on the file name that’s placed
in the folder. That’s why I’m using the ‘-1’. The dates will look like this: '20140131', so I'm using type 112.
declare @fullpath1 varchar(1000)
select @fullpath1 = '''\\system.local\ms\london\FTP\' + convert(varchar, getdate()-1, 112) + '_INDEXPRICES_EOM.SPC'''
declare @cmd1 nvarchar(1000)
print (@cmd1)
select @cmd1 = 'bulk insert [dbo].[SB_Monthly] from ' + @fullpath1 + ' with (FIELDTERMINATOR = ''\t'', FIRSTROW = 5, LASTROW = 675, ROWTERMINATOR=''0x0a'')'
print(@cmd1)
exec (@cmd1)
I think the syntax will be somewhat similar to this:
YEAR(date_column)=YEAR(getdate()) AND MONTH(date_column)=MONTH(getdate())
I’m not totally sure how to incorporate that into my current syntax.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.I tried a couple versions of this.
Declare @StartDate Date, @EndDate Date
Select @StartDate = convert(varchar, getdate()-28, 112), @EndDate = convert(varchar, getdate()-1, 112)
BEGIN
declare @fullpath1 varchar(1000)
select @fullpath1 = '''\\ms\london\FTP\' + ''' between ''' + Convert(Varchar(10), @StartDate, 101) + ''' and ''' + Convert(Varchar(10), @EndDate, 101) + '''_SP.SPC'''
declare @cmd1 nvarchar(1000)
print (@cmd1)
select @cmd1 = 'bulk insert [dbo].[SPBMI_Monthly] from ' + @fullpath1 + ' with (FIELDTERMINATOR = ''\t'', FIRSTROW = 5, LASTROW = 675, ROWTERMINATOR=''0x0a'')'
print(@cmd1)
exec (@cmd1)
END
Here’s the string:
bulk insert [dbo].[SPBMI_Monthly] from '\\ms\london\FTP\' between '02/03/2014' and '03/02/2014'_SP.SPC' with (FIELDTERMINATOR = '\t', FIRSTROW = 5, LASTROW = 675, ROWTERMINATOR='0x0a')
The error message I keep getting is:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'between'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
I feel like I’m already pushing this thing to the limit.
Maybe this last part isn’t possible.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
Hi all
I have a table LFA1 with headers LIFNR, MANDT, NAME1, NAME2, ...., . That table contains data and I need to create text file that collects all headers with all data, where each field is separated by TAB.
thanks for your help.Here is program for KNA1.
*"Table declarations...................................................
tables:
kna1. " General Data in Customer Master
*"Selection screen elements............................................
select-options:
s_kunnr for kna1-kunnr. " Customer Number 1
*" Type declarations...................................................
types:
begin of type_s_customer_details,
name like kna1-kunnr,
address like kna1-adrnr,
title like kna1-anred,
createdon like kna1-erdat,
createdby like kna1-ernam,
end of type_s_customer_details.
Internal table to hold General Data in Customer Master data *
data:
t_customer_details type table
of type_s_customer_details
with header line.
START-OF-SELECTION EVENT *
start-of-selection.
perform select.
*& Form select
This subroutine selects information from database and exports the *
data into presentation layer *
There are no interface parameters to be passed to this subroutine. *
form select .
select kunnr
adrnr
anred
erdat
ernam
into table t_customer_details
from kna1
where kunnr in s_kunnr.
if sy-subrc ne 0.
write : / 'DATABASE SELECTION FAILED'.
else.
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = 'd:\customer_details.txt'
filetype = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
FILELENGTH =
tables
data_tab = t_customer_details
FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
if sy-subrc <> 0.
write : / 'Upload Failed' , sy-subrc.
else.
write : / 'Upload Completed'.
endif.
endif.
endform. " SELECT -
Converting PDF files with tables back to Microsoft Word without lossing the format
I am trying to convert a large amount of PDF files that has tables on them (some are filliable Forms). I need to convert the files to Microsoft Word 10. I have tried to convert the files by using the export option but it would lose the format and the tables would go crazy. Is there a software that I could buy or a process that I could use to get the files to export the files without losing the format. Hopeful I have explained this issue clear enough in order to get help.
That suggests that the PDF was not created with PDF Maker that retains the format information. As a result, there is not much you can do with Acrobat if it is not converting properly. You can try to save as HTML or RTF and import those into WORD. Sometimes those conversions will do better, but not real sure.
You can also use a copy and paste from the PDF with the alt key held down to force the column mode of copy. Unfortunately, with Acrobat there is not much more you can do. There are some 3rd party products that focus on the conversion to WORD and I understand do a much better job for the type of untagged document you likely have. Check with PDF Zone or Planet PDF for the 3rd party solutions. Be aware, they are not cheap either. -
Hi,
I'm using oracle 9i on a server , and microsoft iis 6.0 is running on other server,
I want to create a stored procedure, that read log file exist on iis server, and insert data on a table on oracle server.
I want this procedure to run on daily basis, updating table content, then I will use discoverer to create reports.
how can I do that?Best way to load data from text file to database is SQL*Loader.Actually in 9i the best way might be to use an External Table. This is much simpler to use than SQL*Loader because we can just issue a SELECT statement to get the data. SQL*loader is really only necessary when we have huge amounts of data and perfomance is critical.
Cheers, APC -
Convert Text file encoding in perticular format(Unicode)
Hi Expert,
I have requirement of transfering text file (encoding) in perticular file format to Application server ,by default SAP system generates in ANSI ,is it possible to convert it to Unicode format like UTF-8.If possible then how to generate the text file in unicode.
Thanks,
RegardsCheck
Note 752835 - Usage of the file interfaces in Unicode systems
Markus -
How to convert text file into xml file format with and check that with DTD
I have an text file with | seperator . I have to convert this to an xml file and check with DTD present with me..
plz help me outcan i get some code that how to compare the xml with dtd or just give the DTD name with an XML
-
How to convert text file into xml file
Hi Folks,
I am genarating list of data into text file, but i want to genarate xml file for this text file. How to achive this , please let me know. Thanks.
regards
Vishalhi Vishal,
Use<b> GUI_DOWNLOAD</b> FM and give the file name as <b>file.xml</b> with BIN Mode....
i.e,
Download internal table to presentation server file(PC)
DATA: ld_filename TYPE string value <b>file.xml</b>,
Pre version 4.7 declaration e_file like rlgrap-filename.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
call function 'GUI_DOWNLOAD'
exporting
filename = ld_filename
<b>filetype = 'BIN'</b>
tables
data_tab = it_datatab[]
exceptions
file_open_error = 1
file_write_error = 2
others = 3.
Regards,
Santosh -
Reading Text file & Updating table using PL SQL Procedure
Guys, I am trying to read data from a large text file which
contains tab delimited data. Based on success of validations, I
have to insert/update data in to table(s). Does any one has any
sample procedure to read data (tab delimted/comma seperated)
from a text file and write to database table? Your help is
greatly appreciated!Is there any particular reason why you're not using SQL*Loader
for this? Otherwise you would seem to be re-inventing the wheel.
rgds, APC -
USING WEBUTIL TO READ TEXT FILE INTO TABLE HANGS AFTER CERTAIN NUMBER OF RE
Dear
when we use webutil to retrieve data from text file into database table
(using text_io) it hangs after certain number of records ( approx. 1300
records) while the total number of records to be inserted in the table exceeds
12000 records while it works properly on forms6i with the normal text_io any
help please...?
thanks and regardsWebUtil uploads the files as Binary - so yes you could have some issues if you have a Unix host - however, that would only mean that there is an extra character to trim off of the end of the line read by Text_io.
-
Unable to convert text file to PDF
Hi,
Using Adobe Pro 9 Distiller on Windows 2008 64bit server. So far using Distiller to convert .eps files to .pdf with Standard job options file. I need to convert a .txt file to .pdf and am not able to convert using any of the OOTB job options settings that came with Distiller product installation.
Below is the Distiller output when I tried with Standard job options settings
%%[ Error: undefined; OffendingCommand: MBLDxxxx-03.rpt ]%%
%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%
Can anyone please provide me settings or job options file settings to convert reports in text format to PDF? Thanks in advance.Thanks for the quick response. I was able to generate the PDF using the Adobe PDF writer by opening the text file. Not an issue on 64 bit platform. The .NET application using Distiller to convert eps to PDF via Distiller and moves it over to a watch folder. Another application picks it up and bursts the large PDF to individual PDFs. I need to automatically convert txt to PDF and submit it for burst. Looking for ways to leverage Distiller to automatically convert the txt to PDF. Is it possible? Thanks.
-
Generating Text file from table using Shell script
I am using KSH for generating and FTPing a text file from a table.
While generating Text file I am not getting my Column names in orderly manner.
q2="select COLUMN1||' '||COLUMN2||' '||COLUMN3 from table1;"
set pagesize 0
set head off
set trimspool on
set trimout on
set colsep ' '
set linesize 1500
set trimspool on
spool /ss/app11/oastss/reports/$file2
select 'COLUMN1'||' '||'COLUMN2'||' '||'COLUMN3' from dual;
$q2
spool off;
EOF
I am getting the result some what like below in text file
COLUMN1 COLUMN2 COLUMN3
MALLIK_ACCT 17-SEP-11 908030482
MALLIK_ACCT 17-SEP-11 908266967
MALLIK_ACCT 17-SEP-11 909570766
I want the format like below
COLUMN1........ COLUMN2 .... COLUMN3
MALLIK_ACCT ...17-SEP-11 .... 908030482
MALLIK_ACCT ...17-SEP-11 .... 908266967
MALLIK_ACCT ...17-SEP-11 .... 909570766
I put dots(.) for illustration purpose.
column data length may icrease some times . it shoudl automatically adjust column and data so that they are in alignment. thanks in advance.Mallik wrote:
Hi my question is to format the headers so that they will be in alignment with column data and readable.So you want to output a query as a fixed width format data file? How about this (rather than using scripts)...
As sys user:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
/As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
,p_dir IN VARCHAR2
,p_header_file IN VARCHAR2
,p_data_file IN VARCHAR2 := NULL) IS
v_finaltxt VARCHAR2(4000);
v_v_val VARCHAR2(4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
v_fh UTL_FILE.FILE_TYPE;
v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
d := DBMS_SQL.EXECUTE(c);
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
ELSE
DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
END CASE;
END LOOP;
-- This part outputs the HEADER
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),rec_tab(j).col_max_len,' ');
WHEN 2 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),rec_tab(j).col_max_len,' ');
WHEN 12 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),greatest(19,length(rec_tab(j).col_name)),' ');
END CASE;
END LOOP;
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
IF NOT v_samefile THEN
UTL_FILE.FCLOSE(v_fh);
END IF;
-- This part outputs the DATA
IF NOT v_samefile THEN
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
END IF;
LOOP
v_ret := DBMS_SQL.FETCH_ROWS(c);
EXIT WHEN v_ret = 0;
v_finaltxt := NULL;
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
v_finaltxt := v_finaltxt||rpad(nvl(v_v_val,' '),rec_tab(j).col_max_len,' ');
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
v_finaltxt := v_finaltxt||rpad(nvl(to_char(v_n_val,'fm99999999999999999999999999999999999999'),' '),rec_tab(j).col_max_len,' ');
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
v_finaltxt := v_finaltxt||rpad(nvl(to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),' '),greatest(19,length(rec_tab(j).col_name)),' ');
END CASE;
END LOOP;
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
END LOOP;
UTL_FILE.FCLOSE(v_fh);
DBMS_SQL.CLOSE_CURSOR(c);
END;This allows for the header row and the data to be written to seperate files if required.
e.g.
SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
PL/SQL procedure successfully completed.Output.csv file contains:
empno ename job mgr hiredate sal comm deptno
7369 SMITH CLERK 7902 17/12/1980 00:00:00800 20
7499 ALLEN SALESMAN 7698 20/02/1981 00:00:001600 300 30
7521 WARD SALESMAN 7698 22/02/1981 00:00:001250 500 30
7566 JONES MANAGER 7839 02/04/1981 00:00:002975 20
7654 MARTIN SALESMAN 7698 28/09/1981 00:00:001250 1400 30
7698 BLAKE MANAGER 7839 01/05/1981 00:00:002850 30
7782 CLARK MANAGER 7839 09/06/1981 00:00:002450 10
7788 SCOTT ANALYST 7566 19/04/1987 00:00:003000 20
7839 KING PRESIDENT 17/11/1981 00:00:005000 10
7844 TURNER SALESMAN 7698 08/09/1981 00:00:001500 0 30
7876 ADAMS CLERK 7788 23/05/1987 00:00:001100 20
7900 JAMES CLERK 7698 03/12/1981 00:00:00950 30
7902 FORD ANALYST 7566 03/12/1981 00:00:003000 20
7934 MILLER CLERK 7782 23/01/1982 00:00:001300 10
The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
Adapt to output different datatypes and styles are required (this is currently coded for VARCHAR2, NUMBER and DATE)
Maybe you are looking for
-
How to make data of responsabilitys in read only for users
hi everyone i need help to find a way to make all datas in the E-Business suite application in read only. i try to attach the diffirents responsabilitys with options profiles but i cant make this process work if anyone please know any way to help to
-
Account postings in GR for Subcontracting
Hi Experts, As I know, for GR of subcontract PO, Price Difference (PRD) A/c will also in picture should depends on configuration; SPRO > MM > Inventory Management and Physical Inventory > Goods Receipt > Price Differences for Subcontract Orders at
-
Every time I click on my Note application on my MacBook Pro, the app crashes ... An error page openes. When I click to restart it, it crashes again. After a couple of times, it starts up. Anybody as an idea why it crashes that much and have a way t
-
Firefox is hanging every time I open a Google Map
-
Can you increase additional data in ipad?
CCan you increase additional data in ipad?