Tab Delimited error
Trying to open with Numbers a file exported to Excel from a web financial application I get the message: "This is a tab delimited document, not a valid Excel document. The data might look different".
The file opens fine with Excel. The file opened with numbers shows formatting text, such as:
<td width="60" align="center" valign="bottom">EPS Rtg</td>
What you passed doesn't resemble to an Excel document or a tab separated value one but to a file describing in text mode the data formatting, maybe DIF or SYLK.
Yvan KOENIG (from FRANCE dimanche 19 avril 2009 21:39:12)
Similar Messages
-
Read Tab delimited File from Application server
Hi Experts,
I am facing problem while reading file from Application server.
File in Application server is stored as follows, The below file is a tab delimited file.
##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
i have downloaded this file from Application server using Transaction CG3Y. the Downloaded file is a tab delimited file and i could not see "#' in the file,
The code is as Below.
c_split TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
here i am using IGNORING CONVERSION ERRORS in order to avoid Conversion Error Short Dump.
OPEN DATASET wa_filename-file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
IF sy-subrc = 0.
WRITE : /,'...Processing file - ', wa_filename-file.
DO.
Read the contents of file
READ DATASET wa_filename-file INTO wa_file-data.
IF sy-subrc = 0.
SPLIT wa_file-data AT c_split INTO wa_adrc_2-kunnr
wa_adrc_2-title
wa_adrc_2-name1
wa_adrc_2-name2
wa_adrc_2-name3
wa_adrc_2-name4
wa_adrc_2-name_co
wa_adrc_2-city1
wa_adrc_2-city2
wa_adrc_2-regiogroup
wa_adrc_2-post_code1
wa_adrc_2-post_code2
wa_adrc_2-po_box
wa_adrc_2-po_box_loc
wa_adrc_2-transpzone
wa_adrc_2-street
wa_adrc_2-house_num1
wa_adrc_2-house_num2
wa_adrc_2-str_suppl1
wa_adrc_2-str_suppl2
wa_adrc_2-country
wa_adrc_2-langu
wa_adrc_2-region
wa_adrc_2-sort1
wa_adrc_2-sort2
wa_adrc_2-deflt_comm
wa_adrc_2-tel_number
wa_adrc_2-tel_extens
wa_adrc_2-fax_number
wa_adrc_2-fax_extens
wa_adrc_2-taxjurcode.
WA_FILE-DATA is having below values
##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
And this is split by tab delimited and moved to other variables as shown above.
Please guide me how to read the contents without "#' from the file.
I have tried all possible ways and unable to get solution.
Thanks,
ShrikanthHi ,
In ECC 6 if all the unicode patches are applied then UTF 16 will defintly work..
More over i would suggest you to ist replace # with some other * or , and then try to see in debugging if any further # appears..
and no # appears then try to split now.
if even now the # appears after replace statement then try to find out what exactly is it... wheather it is a horizantal tab etc....
and then again try to replace it and then split..
Please follow the process untill all the # are replaced...
This should work for you..
Let me know if you further face any issue...
Regards
Satish Boguda -
I am getting PAGE_CREATE error while adding a new page. On create new page, after filling page name & description it displays the error message below.
I am runing iAS9\Portal 3.0.8.9 on Win NT4.
No installation errors.
Exact error message:
=======================
ORA-01086: savepoint 'PAGE_CREATE' never established
ORA-06512: at "PORTAL30.WWPOB_PAGE_EDIT", line 320
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "PORTAL30.WWPOB_API_PAGE", line 340
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-01400: cannot insert NULL into ("PORTAL30"."WWPOB_PORTLET_INSTANCE$"."PROVIDER_ID")
ORA-06512: at line 8
=======================
Recompiled all packages\package body (there are no 'Invalid' packages) - error still persist.
when this error occurs, portal displays error message on adding a tab (it happens when I click on the tab icon to add a new tab):
Exact error message:
=======================
Portlet Information could not be obtained. (WWC-44334)
An unexpected error occurred: ORA-06550: line 1, column 34:
PLS-00103: Encountered the symbol "." when expecting one of the following:
( - + mod not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
The symbol "." was ignored. (WWC-43000)
=======================
Everything else in Portal is working fine.
All Rollbacks are online, no error message in the DB alert log.
Any suggestions on how to fix this (other than re-installing portal).
Thanks.
nullWell ... this appears to be a serious problem with the Portal as it renders it incapable of adding pages and tabs. I've tried reinstalling it on 3 different servers, used another instance of Oracle database, and the result is still the same. No installation errors, and suddenly after 7-10 days this error starts appearing.
Am I the only one experiencing this type of error? ...and can anyone offer\suggest ways to fix it? -
Hi all,
we have noticed unproper value modification during export in tab delimited format.
Please find example below:
The proper value is 24150170000011615 (it is state register number of enterprise).
The wrong value is 24150170000011600.
Correct value:
http://s12.postimg.org/v2gpqqzgd/obiee_1.png
How do we export data from obiee:
http://s23.postimg.org/6k7dwiezf/obiee_2.png
Wrong value after export:
http://s22.postimg.org/qdgqgogn5/obiee_3.png
What should we do to fix it?The bigger picture is as follows:
I have a button on my report that essentially should download the output of report to tab delimited text file. This button is integrated with a custom built class which has a main method. When I click on the button, the logic written in the main method gets executed.
In this method I generate my internal table and pass to cl_gui_frontend_services=>gui_download method with parameters mention above.
I try debugging but every thing seems to be working correct when sy-subrc = 0 through executable program and it does not enter into the download method logic when i do it through main method, instead sy-subrc is straight set to 6 (unknown error).
Regards,
Pankaj. -
Opening a tab delimited file and replacing a space
Hi,
I am trying to open a tab delimited file with 4 columns and corresponding values under it. If no value under the column, 0 should be replaced. I used the StringTokenizer and the split methods, but this doesnt seem to work. Any ideas?
E.g
Title1 Title2 Title3
4 7
5 2
SHould be like this:
Title1 Title2 Title3
4 0 7
0 5 2
Thanks..The answer, however, is no. Java is a strongly typed
language; there is no predefined manner in which a
String object can be casted to an Integer object
because a String is not an Integer.
However, if you'd like to create an Integer based on
the contents of a String, you can pass the String to
the Integer.parseInt(String) method. That method
will do one of two things: return the Integer object
representing the integer contained within the String
(if the String represents an Integer) or throw a
NumberFormatException (if the String is not an
Integer).Hi,
Thanks tvynr for your reply. Ok first things, sorry, I had written that post in a hurry. Yes i dont usually put capital letters for my fields. Also i did mean using the add method. Not the get..
And yes I have tried various different type castings. Just to see if one of them would work. And yes i did try Integer.parseInt() by passing in the string to get back its contents as an integer. *And yes the String content is an integer.
Heres a snippet of my code -
List ArrScore1 = new ArrayList(); //List to store Score in one Array
List ArrScore2 = new ArrayList(); //List to store same Scores in another Array. FOr comparisions
List SCORES = new ArrayList();
int dist1,dist2 = 0;
float distance,percent;
while ((record = br.readLine())!= null) //To read from a file line by line from first line
recCount++;
String rec = record;
String [] ScoreScop = rec.split("\t");
ArrScore1.add(ScoreScop[4]));
ArrScore2.add(ScoreScop[4]);
} //End of While loop
System.out.println("Total Records: " + recCount);
for (int i=0; i<ArrScore1.size(); i++)
for (int j = i + 1; j < ArrScore2.size(); j++)
dist1 = Integer.parseInt(ArrScore2.get(j)); //Error I get here is is Cannot resolve symbol. What does this mean exactly?
dist2 = Integer.parseInt(ArrScore1.get(i)); //Same error
distance = dist1/dist2;
percent = distance * 100;
SCORES.add(percent); //Again same error
} //End of j loop
} // End of i loop
I have included all the necessary packages as well. Including :
import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.List;
import java.util.ArrayList;Any idea what I am doing wrong here? -
Is there any methodology whereby a file can be exported, or saved, as a Tab Delimited File?
ThanksSelect All
Copy
Paste in a Pages document
Export as text.
Other way (my preffered one) :
Select All
Copy
run this Script :
--[SCRIPT clipboard2textFile]
Enregistrer le script en tant que Script :clipboard2textFile.scpt
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:
Copiez la table à exporter dans le Presse-papiers.
menu Scripts > clipboard2textFile
Le script créera un fichier TSV (valeurs séparées par TAB).
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as a Script :clipboard2textFile.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:
Copy the table to export into the clipboard
menu Scripts > clipboard2textFile
The script will create a TSV file (Tab separated values).
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
+++++++
Yvan KOENIG (VALLAURIS, France))
2009/07/07
2010/01/10 : Corrigé quelques coquilles dans les explications
--=====
on run
try
set enTexte to the clipboard as text
set fName to (do shell script "date " & quote & "+_%Y%m%d-%H%M%S" & quote) & "." & "txt"
set p2d to path to desktop
tell application "System Events" to make new file at end of p2d with properties {name:fName}
write enTexte to file ((p2d as text) & fName)
on error
if my parleAnglais() then
error "The clipboard doesn’t contain text data. Maybe you selected a Numbers sheet !"
else
error "Le presse-papiers ne contient pas de données texte. Vous avez peut-être copié une feuille de Numbers !"
end if
end try
end run
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) mardi 16 février 2010 21:57:42 -
Re: Tab delimited file(interface prg)
Hi,
I have a problem with tab delimited file.
i am getting one tab delimited file from the user i ahve to import it to the application sever and from the i will give tht prg as input to my prg and i will do some processing and accrodingly i will genrate some file in the format they need till now i dont have any problem
but the records which have errors in the input file it self, for those records i need to generate the error file but while importing it to presentation server from application server that should be again genrate the tab delimited file .. so while genrating error file wht need to be done.. please help me...
am i clear with my explanation
i will reward for all usefull answers....If you are using a 4.7 or older systems then use this
Declare a constant of HEX
constants c_hextab(1) type x value '09'.
and use this constant in concatenate statement to generate a tab character.
Reward points please. -
Split tab delimited file coming from application server.
Hi,
i have received a tab delimited file from the application server.it contains # instead of tab at the application server.
i want to know how to split it.
i tried decalring constant as:
c_tab type x value'09'.
but it gives an error saying only c,n,d and t types are allowed.
please gelp.
Thanks,
Anand.Hi,
Do like this
*--Local Variables
DATA : l_file TYPE string,
l_line TYPE string.
*--Clear
CLEAR : l_file.
l_file = p_ipfile.
*--Read the data from application server file.
OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
*--Error in opening file
MESSAGE i368(00) WITH text-005.
ENDIF.
*--Get all the records from the specified location.
DO.
READ DATASET l_file INTO l_line.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT l_line AT cl_abap_char_utilities=>horizontal_tab
INTO st_ipfile-vbeln
st_ipfile-posnr
st_ipfile-edatu
st_ipfile-wmeng.
APPEND st_ipfile TO it_ipfile.
ENDIF.
ENDDO.
*--Close dataset
CLOSE DATASET l_file.
Regards,
Prashant -
UPLOADING tab delimited file onto FTP server
Hello all
Can i upload a tab delimited file onto the FTP server. If yes then how
points guranteed if answered!!Hi,
Yes you can do this one .. you can have a look at the standard program 'RSEPSFTP'.
REPORT ZFTPSAP LINE-SIZE 132.
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = 'userid'
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = 'unix-host'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
* do some error checking.
WRITE: / 'Error in FTP Command'.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Regards
Sudheer -
ho do i upload a file that is tab delimited, if the file is comma separated we items "split at ',' . how do i split tab separated items
HI Willard
As you know, handling of files w.r.t presentation server and application server differs.
<b>Presentation Server</b>: We can use FM: <b>GUI_UPLOAD</b> for the same.
<b>Application Server</b>:
1. Declare a variable of long text.
Eg: data: l_data(1024) type c.
2. Declate a variable which identifies tab character;
data: <b>l_tab(1) type c value cl_abap_char_utilities=>horizontal_tab</b>.
3. While reading the dataset, read into l_data.
4. Split l_data at l_tab into work area fields.
Eg:
data: l_text(1024) type c,
l_tab(1) type c value cl_abap_char_utilites=>horizontal_tab.
open dataset fname for input in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Error Opening File'.
else.
do.
read dataset fname into l_text.
if sy-subrc ne 0.
exit.
else.
split l_text at l_tab into wa-fld1 wa-fld2 ....
append wa to itab.
endif.
enddo.
close dataset fname.
endif.
Hope the above info gives you some idea.
Kind Regards
Eswar -
Hello,
I have a requirement where i have to write a file in tab de-limited format into an application server. Request you to share your inputs for the same. The challenge is to write it in the Tab Delimited format.
Thanks,
Rahul.Hi,
Save the file as .txt file.
use gui_upload to upload file from presentation server to internal table and then use open dataset to transfer contents to app server.
Refer below code
*& Report Z_CLFO_APP
REPORT Z_CLFO_APP.
DATA:BEGIN OF I_TAB OCCURS 0,
CUST_ID TYPE BU_ID_NUMBER, "Customer ID
IDNUMBER TYPE BU_ID_NUMBER, "Investor ID
LOB(3) TYPE C, "Line of business
BP TYPE BU_PARTNER, "Business partner number
RECNO(5) TYPE C, "Record Number
MSG TYPE BAPI_MSG, "Error Message
END OF I_TAB.
data:l_file type string,
L_FILE1 TYPE STRING VALUE 'CLFO_1.TXT'.
insert
parameters:p_file like rlgrap-filename DEFAULT 'E:/CLFO'.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
start-of-selection.
move p_file to l_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = l_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = I_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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear l_file.
OPEN DATASET L_FILE1 FOR OUTPUT in TEXT MODE ENCODING DEFAULT.
if sy-subrc = 0.
loop at i_tab.
concatenate i_tab-cust_id i_tab-idnumber i_tab-lob
into l_file separated by con_tab.
transfer l_file to l_file1.
clear l_file.
endloop.
close dataset l_file1.
endif.
Message was edited by:
Raghu Devagiri
Message was edited by:
Raghu Devagiri -
Tab delimited file, to populate JTable
Hey all
As Java is fairly new for me I have come into several problems.
First of all i have a program making a tab delimited file, for example like this:
Mig 12345 You
Gig 12345 DouNow i want to read the file and populate each line in the JTable.
But my problem is the transfer from file to object.. This is my code so far:
String[] kolonneNavne = {"Kursusnavn",
"Kursusnummer",
"Point",
"Skemaplacering",
"Liniefag",
"Kursus taget"};
Object[][] kdata ={{null,null,null,null,null,null}};
try {
BufferedReader buff = new BufferedReader(new FileReader("kurser.ini"));
String linie = buff.readLine();
StringTokenizer t = new StringTokenizer(linie, "\t", false);
String kursus[] = {null,null,null,null,null};
int antalKurser = 0;
while (linie != null){
kursus[0] = t.nextToken();
kursus[1] = t.nextToken();
kursus[2] = t.nextToken();
kursus[3] = t.nextToken();
kursus[4] = t.nextToken();
kdata[0][antalKurser] = kursus[0];
kdata[1][antalKurser] = kursus[1];
kdata[2][antalKurser] = kursus[2];
kdata[3][antalKurser] = kursus[3];
kdata[4][antalKurser] = kursus[4];
kdata[5][antalKurser] = new Boolean(false);
linie = buff.readLine();
antalKurser++;
catch (ArrayIndexOutOfBoundsException e){
catch (IOException e){
e.printStackTrace();
}This should read every line in the file, and add the contents to kdata but it doesn't.
I've tried several things, reading the "How to Use tables" by java, and also looking at the Class "Scanner", but havn't got that working either.
I think that the error is in the assigning kursus[j] and kdata[][], but how do i do it? How kan i add contents to an array already having information:
Object[][] kdata;?
Is there a smarter way?
Afterwards i do the essential:
final JTable table = new JTable(kdata, kolonneNavne);Thanks for the debugging thing, i actually didn't know what it did..
Well if i change the assigning from the file with split, it should look like this:
try {
// For at l�se en linie af gangen
BufferedReader buff = new BufferedReader(new FileReader("kurser.ini"));
String linie = buff.readLine();
//Scanner sc = new Scanner(linie);
StringTokenizer t = new StringTokenizer(linie, "\t", false);
String kursus[] = {null,null,null,null,null};
int antalKurser = 0;
while (linie != null){
kdata[antalKurser] = linie.split("\t",5); // Or should this be kdata[0][antalKurser] ???
kdata[5][antalKurser] = new Boolean(false);
linie = buff.readLine();
antalKurser++;
catch (IOException e){
e.printStackTrace();
}But i still get errors when running the code...
Do i assign the data correct? It seems to me that that is the problem... I have tried searching for "object assign data java" but, all that comes up is "Object oriented programming with java"... Which i s understandeble beacause of java being Object oriented...
Hmm.. Hope you could help me with assigning the data!
It comes with this error:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 5
at KursusTabel.<init>(KursusTabel.java:51)
at KursusTabel.createAndShowGUI(KursusTabel.java:103)
at KursusTabel.access$100(KursusTabel.java:15)
at KursusTabel$2.run(KursusTabel.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Is it the first error that processes every other error? Thanks! -
Tab delimited file not getting loaded properly in OWB
Hi,
I have create a flat file module and liked it to an external table in OWB, but out of 5000 records only 3000 are getting loaded into external table for tab delimited flat file.
Could any body has any idea how this is happening.
Thanks
RamHi Ram
Best thing to do is to configure the external table to have a log file name, bad file name etc.. and see the errors reported when you query the external table. This will help you identify the records in issue. If you reconfigure external table, redeploy the external table and then query the external table....read the log files etc. to see what is up, may be a data conversion issue in some records, or something completely different.
Cheers
David -
How can I save a Numbers spreadsheet as a tab delimited file?
Okay, I would like to save a Numbers spreadsheet as a tab delimited file. But of course I can't do that, since Numbers only saves as a comma separated values file.
Plan B: I can open up a CSV file created by Numbers in TextEdit, and I would like to Find and Replace all the commas with tabs. So I open up the Find window, enter a comma under Find, but of course when I put the cursor in the Replace blank and hit the Tab key, it just goes to the next blank instead of giving me a Tab.
Is there a way I can get a Tab into that blank so I can replace all the commas with tabs?
--DaveHello
When we use TextEdit as I described, rows are separated by Returns.
It appears that your program requires LineFeeds.
Here is a neat soluce.
Save this script as an Application Bundle.
--\[SCRIPT tsv2csv]
(* copy to the clipboard a block of datas separated by tabs
run the script
You will get on the desktop a csv file named from the current date-time.
The values separator is set to match the Bento's requirements:
If the decimal separator is period, the script uses commas.
If the decimal separator is comma, the script uses semi-colons.
This may be changed thru the setting of the property maybeSemiColon.
According to the property needLF,
embedded Returns will be replaced by LineFeeds
or
embedded LineFeeds will be replaced by Returns
Yvan KOENIG (Vallauris, FRANCE)
le 10 octobre 2008
property needLF : true
(* true = replace Returns by LineFeeds
false = replace LineFeeds by Returns *)
property maybeSemicolon : true
(* true = use semiColons if decimal separator is comma
false = always uses commas *)
--=====
try
set |données| to the clipboard as text
on error
error "the clipboard doesn't contain text datas !"
end try
set line_feed to ASCII character 10
if |données| contains tab then
if maybeSemicolon then
if character 2 of (0.5 as text) is "," then
set |données| to my remplace(|données|, tab, quote & ";" & quote)
else
set |données| to my remplace(|données|, tab, quote & "," & quote)
end if -- character 2 of (0.5…
else
set |données| to my remplace(|données|, tab, quote & "," & quote)
end if -- maybeSemiColon
end if -- |données| contains tab
if needLF then
if |données| contains return then set |données| to my remplace(|données|, return, line_feed)
set |données| to my remplace(|données|, line_feed, quote & line_feed & quote)
else
if |données| contains line_feed then set |données| to my remplace(|données|, line_feed, return)
|données| to my remplace(|données|, return, quote & return & quote)
end if -- needLF
set |données| to quote & |données| & quote
set p2d to path to desktop as text
set nom to my remplace(((current date) as text) & ".csv", ":", "-") (* unique name *)
tell application "System Events" to make new file at end of folder p2d with properties {name:nom}
write |données| to file (p2d & nom)
--=====
on remplace(t, tid1, tid2)
local l
set AppleScript's text item delimiters to tid1
set l to text items of t
set AppleScript's text item delimiters to tid2
set t to l as text
set AppleScript's text item delimiters to ""
return t
end remplace
--=====
--[/SCRIPT]
Yvan KOENIG (from FRANCE vendredi 10 octobre 2008 13:47:36) -
Broken AppleScript for tab delimited importing into AddressBook
I have a tab delimited file that is not quite ready to import into AddressBook - it needs some massaging first (field merging, context sensitive edits etc.). A book (OS X Missing Manual) referred me to some AppleScripts used by AddressBook which are located in:
/Library/Scripts/Address Book Scripts/Address Importers
So I modified the "Tab Delimited Text File.scpt" file contained in there to accommodate all of the field merging etc. that I needed to do, but when I run the script it doesn't do anything. In fact, ALL of the scripts in that place just bring up a dialog box describing their capabilities, and then just quit. The book says these scripts work great... Would some kind soul please let me know how to run these scripts so I can point them to a tab delimited text file and do the import. Note that I'm able to figure out how to do my local changes in the AppleScript code, but I'm a total novice in AppleScript itself (but I can program well in other languages). I figure that because none of the scripts in that directory run, the error isn't mine (yet).
Thanks,
MickSorry for the late reply - I had already figured out that the scripts were subroutines, but also thought they might run solo (they didn't). Another surprise was that the parent routine (/Library/Scripts/Mail Scripts/Import Addresses.scpt) was hard coded to call the children scripts in the Mail directory instead of the Address Book directory. I'm not clear if that's a bug on Apple's side...
Anyway, I got it all working. The import procedure was excruciating slow - it took well over an hour! The next time I get an update of the database to import I'm coding something up in awk instead of an AppleScript.
Thanks again for your help.
Maybe you are looking for
-
HCM = FI: Posting an IDOC via Workflow
Hello, I hope I'm right here in this part of the forum. In addition I hope my explanations will be good enough to understand. Every month the HCM-System send IDOCs (payment of salary) to the FI-System. Everything works well (in partner profile (WE20)
-
I forgot my ipad lock code and when i tried to restore it from yhe itunes it keeps requiring to switch off my ipad finder, i need yo open it whatever is the way
-
Hello, I have designed a form in Adobe LiveCycle designer with rights enabled PDF,As we cant collect PDF directly from users due to 500 use licensing limit.Plan is to have users send the XML via 'Submit By Email' button and from my end recreate t
-
Power View crash after selecting one bar
After the December update, 15.0.4675.1002, my power view sheets crash (they disappear) after selecting one bar (or column) in a graphic. 32 bits version in Spanish language.<o:p></o:p> Any suggestion or workaround? Best Regards.<o:p></o:p>
-
Error when creating a partition
I'm trying to do bootcamp on my 2007 iMac with Mavericks. I have a 32bit copy of Win7. Doesn't seem to matter though because I can't get past the bootcamp assistant trying to make a partition. Every time it just says "an error occurred." Doesn't say