Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add double quotes to each field


HI all,

Not sure if this is the correct forum for this question, feel free t
move it if not.

My issue is I have made an excel sheet that contains 500 rows and 1
columns.
I need to export this as a CSV but when exproting, each field MUST b
delimited by double quotes ex: "data"

When taving either as a CSV or tab delimited text, it does not put th
quotes in.
How can I do this?

The data must be formated as such:
"product_sku2","product_s_desc","product_desc","TN _pic2.jpg","pic2.jpg","","","","","","","7","","N" ,"","Produc
Name2","87.78","category/level1/level2|category2/level1/level2","1"

Thank you in advance for any help provided

--
npereir
-----------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...fo&userid=1079
View this thread: http://www.excelforum.com/showthread.php?threadid=47537

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add double quotes to each field


One way: I assume your data is in A1:S500. In T1, enter this formula:

=CONCATENATE("""",A1,"""") NOTE: that is 4 double quotes i
succession, A1, then 4 more dble quotes.

Copy this to the right 19 columns, then copy all 19 cells (T:AL) dow
the 500 rows.

Now, all of your entries should be replicated, surrounded in doubl
quotes. At this point you could delete columns A:S and then proces
your export.

Does this work for you

--
swatsp0

-----------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...fo&userid=1510
View this thread: http://www.excelforum.com/showthread.php?threadid=47537

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Add double quotes to each field

If you feel comfortable with VBA, select the cells you want to process and run:

Sub Macro1()
Dim r As Range
For Each r In Selection
r.Value = Chr(34) & r.Value & Chr(34)
Next
End Sub
--
Gary's Student


"swatsp0p" wrote:


One way: I assume your data is in A1:S500. In T1, enter this formula:

=CONCATENATE("""",A1,"""") NOTE: that is 4 double quotes in
succession, A1, then 4 more dble quotes.

Copy this to the right 19 columns, then copy all 19 cells (T:AL) down
the 500 rows.

Now, all of your entries should be replicated, surrounded in double
quotes. At this point you could delete columns A:S and then process
your export.

Does this work for you?


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=475371


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add double quotes to each field


does not seem to work correctly as after exporting to CSV, the CSV file
shows this:

"""1805""","""plastex/mini-kit.jpg""","""Mini Master Kit""",""""""

There are 3 Double quotes when there should only be 1


--
npereira
------------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=475371

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add double quotes to each field


Odd, if there are only single quotes <before you export, that you would
end up with <triple quotes after. Are you sure you need to add the
quotes before the export?

Maybe try this: Copy the range with the formulas, then Paste
SpecialValues to remove the formulas and end up with just the plain
text entry e.g.: "data". Then export. Any change?


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=475371



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add double quotes to each field

putting your data inside double quotes within the worksheet is a
non-starter. When you export it, Excel will delimit the existing double
quotes with double quotes and enclose the entry in double quotes. This is
expected behavior - no mystery. This is what it has to do to reproduce what
you have in the sheet, so the changes should not be made in the sheet.

See K Dales' suggestion or look at this article:

http://support.microsoft.com/default...b;en-us;291296
Procedure to export a text file with both comma and quote delimiters in

--
Regards,
Tom Ogilvy

"swatsp0p" wrote in
message ...

Odd, if there are only single quotes <before you export, that you would
end up with <triple quotes after. Are you sure you need to add the
quotes before the export?

Maybe try this: Copy the range with the formulas, then Paste
SpecialValues to remove the formulas and end up with just the plain
text entry e.g.: "data". Then export. Any change?


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile:

http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=475371



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add double quotes to each field


Tom Ogilvy Wrote:
See K Dales' suggestion or look at this article:

http://support.microsoft.com/default...b;en-us;291296
Procedure to export a text file with both comma and quote delimiters
in


Excellent, this worked like a charm... Thanks


--
npereira
------------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=475371

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add double quotes to each field


Anyone know how to do this

--
npereir
-----------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...fo&userid=1079
View this thread: http://www.excelforum.com/showthread.php?threadid=47537

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Add double quotes to each field

Don't know how to do this with a simple "Save As..." or anything, but you
could build the output file yourself with code:

Public Sub CSVOut(DataRange as Range)
Dim RowCount as Integer, ThisRow as Integer
Dim ColCount as Integer, ThisCol as Integer
Dim CSVString as String
' Determine number of rows and columns
RowCount = DataRange.Rows.Count
ColCount = DataRange.Columns.Count
' Open file to write text output:
Open "C:\CSVOutFile.csv" for Output as #1
For ThisRow = 1 to RowCount ' Loop through rows
CSVString = "" ' reset the output string
For ThisCol = 1 To ColCount ' Loop through columns and build the string
for a new line
' Get cell value and append it to the string with quotes ("):
' (Note: if this is the first column we do not need a comma,
otherwise we do)
If ThisCol < 1 Then CSVString = CSVString & ","
CSVString = CSVSTring & """ & DataRange.Cells(ThisRow,ThisCol).Text
& """
Next ThisCol ' end of column
'Write the line of csv data to the text file:
Print #1, CSVString
Next ThisRow
Close #1
End Sub


--
- K Dales


"npereira" wrote:


HI all,

Not sure if this is the correct forum for this question, feel free to
move it if not.

My issue is I have made an excel sheet that contains 500 rows and 19
columns.
I need to export this as a CSV but when exproting, each field MUST be
delimited by double quotes ex: "data"

When taving either as a CSV or tab delimited text, it does not put the
quotes in.
How can I do this?

The data must be formated as such:
"product_sku2","product_s_desc","product_desc","TN _pic2.jpg","pic2.jpg","","","","","","","7","","N" ,"","Product
Name2","87.78","category/level1/level2|category2/level1/level2","1"

Thank you in advance for any help provided.


--
npereira
------------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=475371


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Double Quotes [email protected] New Users to Excel 2 July 20th 08 12:43 PM
Double Quotes PeterM Excel Discussion (Misc queries) 5 June 17th 08 05:12 PM
export .CSV with field containing double quotes? William DeLeo Excel Discussion (Misc queries) 5 April 5th 06 06:08 PM
Double Quotes Ed Excel Programming 1 January 13th 04 01:13 AM
Double Quotes Ed Excel Programming 1 January 12th 04 09:18 PM


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"