Is there some way to write a csv file such that , when opened in MS Excel , it will open in different tabs in the workspace ?
The short answer is, NO.
For that matter, the long answer is NO too.
csv is a continuous run of lines of values separated by commas. each line doesn't even have to have the same number of values etc. there's no concept of workbooks or different "areas" in csv. Excel cannot be cajoled into opening a csv into multiple workbooks...well at least not without writing VBA to parse the csv file yourself.
the oxml or whatever they've ended up calling the xml file spec for office, allows workbooks and is still easy to deal with being text based. Do you have to use csv or can you switch (at least part way through) to xml?
Related
I am using Read Delimited Spreadsheet.vi in LabVIEW and need to read data from other than the first sheet. How do I tell LabVIEW that want to use other than the first sheet?
CSV files are plain text files and there are no multiple sheets inside.
Sheets are present within Excel files, but this function "Read Delimiter Spreadsheet" does not work with these.
Unfortunately LabVIEW still doesn't have built-in support for reading Excel files as far as I know, although it can write them with the Save to Measurement File express VI.
There are third-party toolkits available for reading Excel files in LabVIEW, or you might be able to use some Python code with openpyxl or pandas.
I suppose you need to read a Excel file (.xls or .xlsx) and not a CSV file (as suggested by Mateusz the CSV file doesn't have sheets).
Anyway, in LabVIEW you can read, write, manipulate and do any other operations on Excel files by using ActiveX. It is verbose but you can use it as any other LabVIEW library.
Look this post or the built-in examples in your LabVIEW environment
As mentioned above, you can use Excel to read a spreadsheet. Alternately, you can use LibreOffice.
LibreOffice to LV library
i am exporting data from database to file, which can Excel read and save.
(CSV) I generate csv, with default format (according to RFC 4180, comma delimeter). As expected, stupid excel read all data and place it to one cell.
(CSV with semicolon delimeter), this one excel read fine, but after change some value and press save (CTRL+S), stupid excel saved it to unreadable file (well done!). No delimeters, no string separators. Ok, so i tried to save it as (CSV format with SEMICOLON delimeter), saved file looks ok, but after opening it with excel, error message was showed - INCORRECT FORMAT - no cell found :D really?!
Generating .xsl file in php. It take too much RAM (about 2GB), so it cant be used.
Do you know any good format, which can excel easily open and easily save?
Thanks a lot!
This question is off-topic, but IMHO Excel 2002/2003 XML Format would be the best choice in your circumstances.
The reason for this is that the data in this format is typed - so you will not see numbers misinterpreted as dates, or phone numbers with leading zeros stripped. I am not aware of the kind of problems you describe, so I cannot say for sure how those will be affected.
I am encountering what I believe to be a strange issue with Excel (in this case, Excel 2007, but maybe also Excel 2003, but don't have access to it as I write this).
I can reliably convert some server data over into a tab-delimited format (been doing this for years) and then open it using Excel - no issue.
However, what seems to be happening is if I have an html <table> inside one of the fields, it looks like Excel 2007 thinks it should be converting the table into rows and columns inside Excel (not what I want). As you might imagine, this throws off the entire spreadsheet.
So question is, is there any way to set up excel to NOT do this (perhaps some setting in Excel that pertains to reading tab delimited files), or am I missing something?
Thanks.
Save your file as .txt
Now open the file in excel using Drag and Drop (rather than double clicking your hookey .xls)
Slightly more work to open the file, but your tab text formatting will now be respected.
When you open the tab-delimited file, you are shown an import mapping dialog that lets you pick each columns' data type (date, text, currency, etc.). For the columns that have HTML data present, choose text. This will tell it basically to import as-is and not try to automatically parse the data into a derived format.
Excel 2003 does the same. I don't think there is a way to do it with a config because Excel finds delimiters in the html table and breaks the html in cells and columns as it does for the other columns.
If the column containing html is always the same, you can use JYelton suggestion of renaming the file as csv and record a small VBA macro to load the file selecting automatically the html column as text in the import mapping dialog and you load the file calling the macro instead of double-clicking on the file.
If nothing else, import it into OpenOffice.org Calc, save as an .xls file, then open in Excel.
I have been trying to import this excel file my mysql database, and it has been rough.
There are around 7,000 rows in the .xls file, but when I export it to .csv and parse it with PHP I get one of two issues:
Excel does not escape anything, ie. the commas in each row split the data
When I change all commas to * then export for some reason excel changes a whole bunch of lines to a bunch of pound signs #####.
(Is there a reason it does this?)
I can upload the .xls somewhere if need be.
As a suggestion, if you are dealing with cells that do contain commas which are widespread, an easy solution would be to export from Excel in a Tab-Delimited format (TXT), or yet alone any format that contains a character you would not normally encounter.
I've found it to be a pretty simple way to take care of many of the troubles associated with exporting from Excel and importing into a database medium.
Figured it out!
Turns out it was Excel's fault. I checked the .xls before opening it in Excel, not ###.
But after saving it in Excel they appeared.
So I opened it in Numbers (part of iWork), changed all , to *, and all quotes to % (these never appeared in any line. Exported it to .csv, then changed them back when importing with PHP.
Worked great. :-)
Is is possible to change the default data type Excel uses when opening a .csv file? I would like Excel to default to TEXT rather than General for the Column Data Format when reading a .csv file.
I would like to be able to open a .csv without having leading 0's removed from my data. Currently I use the Import External Data wizard when reading a .csv file but I would prefer to be able to use File/Open or to just double click on the .csv file.
One option is to record a macro of the import process, that way you can define the TextFileColumnDataTypes to be Text.
When you record the macro you will see that the format is set with the line .TextFileColumnDataTypes = Array(2, 2, 2)
where 2 sets the Text format and the 3 elements in the array refer to 3 columns.
You can set the array to contain more elements than the number of columns you expect to have in your text files as any extra are ignored.
You can press F8 to launch the Macro dialog which shortens the process such that it';s similar to opening from the file menu (although still not as convenient as being able to double click a file).
I found a useful example macro with some further explanations here
This goes into a bit more detail eexplaining what the relevant settings do, e.g. setting the correct delimiter in the macro etc.
If you have the option, you can save the data to an XML spreadsheet (I know, these files get large very fast) - to open it, just drag it to an open Excel window. This is the only way I know of to get the result you'd like. -- It is only useful for moderate to small data sets.