Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Using C to convert excel spreadsheet into mysql Date: Sun, 11 Dec 2016 01:33:55 -0800 Organization: None to speak of Lines: 49 Message-ID: References: <70dc8aa0-d591-41c2-8d56-329162cda0d6@googlegroups.com> <7b8881c5-ab07-48e7-bbbc-815ac078ebe6@googlegroups.com> <4cdcab1e-db28-422d-9fd9-452134419922@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="d0d5c56ca22fa2e528cedb366e6a556f"; logging-data="5581"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19LJW9cbU/LtLG4v/5TPS5q" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:iyFYi2gPUfxquqfdaFjeodKLcdQ= sha1:+DpBxcGueWfYPl7zslGSUzAh0UY= Xref: csiph.com comp.lang.c:98770 Alla _ writes: > >> Only the ones that are inherent in the data. Thus, for "Income >> Statement" there should be a space between the two words. But there >> shouldn't be any leading, trailing, or intervening spaces in numeric >> fields. You're right about that. The solution is to tell Excel not to >> save the dollars and so on. Look for a checkbox on the filter settings >> marked "cell contents as shown", and un-tick it. >> >> > Also, it seems I have to delete all minuses >> > in the original file because as the 4th row from the bottom shows >> > csv reads it as it is usually formatted in Excel (1). >> >> Again, getting rid of "save cell contents as shown" will fix this. >> > I am sorry for asking only now, but I have saved the book with a > raw data and still have numerous commas at the end, although > I have deleted a few rows as well. I wonder what do these commas > indicate - you do not have them in your csv file. Copying from your followup: > Income Statement,2011,2012,2013,2014,2015, > Sales,1062,1252,1587,1934,2519, > Cost of Goods Sold,654,814,1009,1190,1499, > Gross Profit,408,438,578,744,1020, > SG&A,254,271,364,454,576, > Operating Income before Depr,154,167,214,290,444, > Depreciation and Amortization,25,31,38,52,70, > Operating Profit,129,136,176,238,374, > Interest Expense,4,3,3,1,4, > Other Gains and Losses,0,7,10,0,-1, > Pretax Income,125,126,163,237,371, > Income Tax Expense,55,52,65,92,141, > Net Income,70,74,98,145,230, > ,,,,,, You have a CSV file with 14 rows, each containing 7 comma-separated fields. In the first 13 rows, the first field is a string and the remaining fields are numbers. In the final row, all 7 fields are empty. If you don't want that final row of empty fields, you should be able to just delete it in Excel and re-save it. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"