How to export cells with links, when saving to a csv? - excel

I am trying to export an Excel file (.xlsx) to a csv, with LibreOffice. Some columns have hyperlinks, which I can open when the sheet is open in LibreOffice. The cell does not show the link, but a short summary text: the link is somehow a property of the cell (or the text, not sure).
I would like that the CSV contains the links for the affected columns (I don't care about the short summary text), but by doing a "Save As csv" I am losing the links. What can I do?
EDIT
I have investigated a bit: the hyperlink can be manually created in Libreoffice in a cell with Ctrl-K or from the menu Insert -> Hyperlink. When I try to export the csv, I am offered two relevant options:
save cell content as shown
save cell formulas instead of calculated values
I have played around with them, but those are not helping at all.
Is there any way of exporting the hyperlinks instead of the text?

From what I can tell, the CSV export filter always saves the link text, not the link URL. This behavior occurs when saving from LibreOffice format as well, so your question does not need to involve Excel or the .xlsx format.
What I would probably do is write a macro to create a CSV file with the URLs. If you want to try that, then have a look at https://wiki.openoffice.org/wiki/Documentation/DevGuide/Accessibility/XAccessibleHyperlink.
Depending on what you are trying to do and how much time you are willing to invest, you can create your own filter.
Another option that requires programming would be to use the HTML export filter, which saves both the link text and link URL, and then write some code to parse out the URL.

Related

creating dynamic hyperlinks when importing data into excel

I am trying to automate a process where data is queried from the database, downloaded into an excel file and sent to recipients. One of the column in the excel file needs to be a hyperlink. How can i make this happen?
I selected =hyperlink(A,B) into the column but the function appears as text and not as hyperlink.
I tried changing the web options to 'update links on save' but it does not help.
Only when i click in the cell and hit enter does the hyperlink appear. This is not an option
Opening the file and adding a new column to use the hyperlink function is not an option either since the process is being automated.
The tool allows me to export into an xlsx and not a xlsm so i am assuming i cannot use macros to do the job.
I tried researching the answers for similar questions but didnt find any that i could use which will generate a url dynamically without me having to open the file. Any ideas?
I also tried another tool and they were able to send out emails with links. I do not know how they do it internally but i do not see any hyperlink functions when i tab into the hyperlink column.
Cell type should probably be set to "Generic".
You may also need to trigger a "Refresh" after the workbook is filled with all the data. Sometimes I need to that manually - but only once. I have no idea why it happens.

Automate opening and formatting of csv file in unix

My requirement is as follows:
Open an input csv file in spreadsheet in unix (like ooffice)
Post process the excel for following requirements:
Post process a column such that fields with number less that 0 appear as red
Put filters on top of each relevant columns (As we can do in Microsoft excel)
save the file in .xls (or any other format) such that when opened in microsoft excel, the data formatting is not lost.
The above automation requirement is part of my flow. Though I am familiar with scripting, I have never worked on such requirement.
Will really appreciate your help.
Here is a solution using csv2odf that should get the result you want:
Create a spreadsheet template in Excel or OpenOffice with these specifications:
Insert column titles with the same number of columns as the csv. (If you want to use titles from the csv file, add the -H option to the command below.)
Add one sample row of data. Use dummy numbers where numbers will go and dummy text where text will go. Format the text/numbers however you want, including conditional formatting to make negative numbers red.
Save the template as xlsx or ods (xls will not work).
Run this command:
csv2odf yourdata.csv yourtemplate.xlsx output.xlsx
Your data will be inserted into the template and the formatting will be duplicated on each row.

Getting formulas out of Excel

I have a spreadsheet that I need to convert into code. Is there a way to export the spreadsheet that keeps the formulas intact?
When I save it as any other format it converts the formulas to their values. For example, if I had =(4/2), the CSV would just put 2. Whereas I need the original formula. I have tried accessing the spreadsheet using PHP Excel also but it cannot load the spreadsheet due to size.
Simplest way is to do CTRL+` and then copy+paste to Notepad or wherever you want

Excel and Tab Delimited Files Question

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.

Excel: Default to TEXT rather than GENERAL when opening a .csv file

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.

Resources