Saving CSV in UTF-8 on Mac - core-data

I am having problems to save a CSV file for Core Data using my Mac, works if I save in Windows computer but not in the MAC. I am using Excel. Every time I run the CSV file saved in MAC there are different errors in the Xcode.

In my experience when you save CSV files in a Mac computer it is always a mess. I had several problems dug in the forums and realize only could save CSV in PC with windows. If you are using UTF-8 in your coreData you can workaround with this, I am doing this for some time and never had problem again in my Mac.The way I do:
Save the .CSV file (comma delimited) in Excel.
Open the .CSV file with (http://www.sublimetext.com/2
File > Save with Encoding > choose the one you want.
Done.
If you have to edit or open the file in Excel, you have to save in Sublime Text 2 again before you drag to your Xcode project.
Forget Windows computers :)
Hope this solve your problem.

Related

Batch file creation: Convert xls to csv using only batch script

I have done quite a bit of searching before posting this question so let me outline what I am trying to do.
1.) I do not want to use applications I have to download from a website or created custom commands (please no start Xls2Csv.exe here's a link to a website where you can download the program) I do not want to download a program to do this.
2.) I want to keep it in the batch file if possible - I have tried the vbc/vbs/vb files that is not what I am looking for.
3.) I found this an this is close to what I need but if I can stay within a batch file that would be best: Can a Batch File Tell a program to save a file as? (If so how)
Background
I have a bunch of test records stored in excel sheets within folders. Each test record has autoformatted name so the only real difference between any of the filenames is a serial number, otherwise each file name is formatted the exact same way.
I have written a batch file to search and find the files I need but I am stuck on obtaining a tiny bit of information in a .xls file.
What I am trying to do - I have excel files (.xls) and there is a word in a cell on one of many sheets that I would like to copy into a textfile. However I am unable to use findstr for an excel find because the command searches the file as if you opened it in notepad and the data I need is not present.
I am not concerned of data loss as long as I can get this tiny bit of information to a text file.
Otherwise what I have found to be the best solution is to convert an XLS to a CSV. I have manually done it by opening the file and saving as type .csv that worked.
What hasn't worked is:
example1.xls >> example2.csv
ren example1.xls example3.csv - this will save it as a csv file but still opens with the same formating of the xls file in both excel and notepad.
I was hoping that the was a command to recreate the manual process of opening the file and saving as csv.
If there are any other suggested solutions - maybe a command where I can search for a string within an excel file? That would be the simplest option.

File created in linux transferred to Windows shows corrupted

I have created an Excel file from delimted text file using awk in linux terminal transferring the same to windows. when opened it shows a pop-up "This file might be corrupted or unsafe.would you like to open?"But on tapping yes I could see data everything is fine as expected.How to avoid such pop-up.
I have tried to convert to .xlsx then I couldn't even see the data
I tried to zip and send then unzip same warning popsup
My guess as to what is going on is that the incoming Excel file is still basically a Linux file, but MS Office, being flexible, is allowing you to open it. For a one time fix, try the following steps from Windows Excel:
Open the Linux Excel file (some_file.xlsx)
Save as another file name (some_new_file.xlsx)
Close Excel
Delete some_file.xlsx and rename some_new_file.xlsx to some_file.xlsx
Now try opening the file again, and hopefully the error message will have gone away.

export data with chinese to CSV

I am trying to export data containing chinese(some non-english characters for that matter) from ui-grid to pdf or CSV. However the exported text is all garbled. Here is the plnkr link
http://plnkr.co/edit/ZR34lhm3LUNmUrj7Vg23?p=preview
I understand for the pdf export to work I need to have the correct cmap for the font and characterset in use but why is CSV export not working? I have even tried exporterOlderExcelCompatibility: false but that didn't help either.
Did you try with:
exporterOlderExcelCompatibility: true
(false is the default).
I had a problem exporting Umlaut character to CSV, and I fixed it using exporterOlderExcelCompatibility: true in the gridOptions configuration.
The issue you are facing with the CSV is most likely due to opening this in Excel. I do not face the issue with OpenOffice.
For Excel 2013, these steps should work:
Launch Excel, and go to the Data tab.
Click the From Text button.
Navigate to the exported file, and click open.
Set the encoding to UTF-8 if it wasn't auto-selected.
Click Next.
Change the delimeter to comma.
Click Finish.
Choose where you want the input, or just click OK.
At this point, you should have the CSV displaying correctly.
With the CSV exporter, CSV-JS, I do not see any options to set the encoding before hand.
If you have small file: open your csv using Google sheet. and save it as csv. It will work.
if you have large file: try open office( free and easy to download). Open with Open Office excel and save as utf-8.
The default English Windows encoding for Chinese is GBK. For Ubuntu is utf8t. Make sure you have the irght encoding for your system.

Convert .xls to .pdf using LibreOffice via Command Line

I'm trying to convert a .xls file to .pdf using LibreOffice via command line on Ubuntu. I have a kind of report on the .xls file with some colors in the background of the cells and etc.
The problem is when I convert the .xls file, the .pdf loses the original format. Each page is broken almost in the half and the content of one page is displayed in two different pages.
Does anybody know how to convert the .xls file to .pdf via command line with keeping the original format?
Or some trick to set the size of the .pdf page to not break pages? (Also via command line)
The code I used to make the conversion was:
soffice --headless --convert-to pdf:"impress_pdf_Export" filename.xls
If you use LibreOffice to convert Microsoft Excel (XLS) files to PDF documents, this is a two-step process (even if your command does look like it is a one-step process):
Import the XLS into LibreOffice (even if started with --headless).
Export the PDF from LibreOffice.
If the result does not look like you expect (not similar enough to Excel's native PDF export), then start with debugging the first step from above:
Open the XLS file with LibreOffice in a GUI. Does it look like you expect it to look? Or are some formatting options looking weird?
Export the PDF from there (with the GUI). Are the page dimensions as you expect? Did you set them up how you prefer? The margins like you want them? etc.pp. ...
If you are working on Windows, you may also want to consider OfficeToPDF.exe. It is hosted on CodePlex, licensed with the Apache 2.0 License and available in binary and in source code.
It requires a working Office 2013, Office 2010 or Office 2007 installation. But then it can commandline- and batch-convert to PDF various MS Office-based file formats, including XLS(X), PPT(X), DOC(X), VSD(X) and PUB as well as Libre/OpenOffice-based ODT, ODS and ODC files.
Although this is a little bit off from the initial question (you don't _really need Office Libre if you have the Office suite and on a Windows machine)
I do appreciate the follow-up provided by Kurt. It prompted me to post the following Gist offering some clear instructions on how to go about using the .exe in a for loop.
https://gist.github.com/einsty/2189cae4175f619cff0f
Try copying appropriate font file (for me it's
a simsun.ttc file) to your libreoffice installing directory like '/opt/libreoffice4.2/share/fonts/truetype'.But if the width of a single excel sheet is too much for a print page(sth like 'A4'),it'll still collapse.

mass convert Excel files into tab-delimited text files

Is there a tool to convert a large number of excel files into tab delimted files automatically?
I just through this together, its not pretty but should do what you need. Tested on WindowsXP / Office2007.
download from: http://stembro.byethost17.com/utility_scripts/xl2tab/xl2tab.html
Extract the xl2tab.vbs file to the directory containing the excel files and double-click to run. It will place the converted files into a new directory called "output." The original directory-structure remains intact within the output folder.
I don't think there are any good free tools to do so right now, but you could look into using the Open Office API to write something,
[http://www.oooforum.org/forum/viewtopic.phtml?t=7657&highlight=convert+xls+csv+command+line][1]
Or for a quick and dirty solution, you could record and Open Office Calc macro that would do it, and launch that macro from the command line.
This might also help http://dag.wieers.com/home-made/unoconv/
convert to csv, and maybe replace , with tabs?

Resources