0

I would like to pragmatically create a CSV and link local files. When I create the file I will be creating a zip that will contain the csv file as well as the files that I want to link to.

I know that csv does not specify a format for hyperlinks as its just a text file. However after a little research I found I can do something like this:

A1: =CELL("filename")
A2: =LEFT(A1,FIND("|",SUBSTITUTE(A1,"\","|",LEN(A1)-LEN(SUBSTITUT(A1,"\","")))))
A3: =HYPERLINK(A2 & "brn-0001.xlsx")

However this does not work on a mac as the path separator is "/" not "\". Is there a way to get the path separator in Excel.

Is this really my only option? Other than never using CSV ;)

Nick.Mc
  • 18,304
  • 6
  • 61
  • 91
lostintranslation
  • 23,756
  • 50
  • 159
  • 262
  • Programatically? Which platform? You've ruled out VBA below even that would be the obvious one. – Nick.Mc May 05 '15 at 03:39
  • I am creating the csv file in a nodejs server. Output is just raw csv from my web client. But it should not matter where I create the csv. Because it can be exported on OSX or Windows I need the csv to work with either platform if possible. Unfortunately there does not seem to be an excel function to ask for the path separator. – lostintranslation May 05 '15 at 03:45
  • 2
    I've added the node.js tag. It would have been handy to know from the start. If I understand correctly node.js runs on a server, so the web client is going to have to explicitly tell it what the OS is. This seems to be a good guide on detecting from the client side. http://stackoverflow.com/questions/10527983/best-way-to-detect-mac-os-x-or-windows-computers-with-javascript-or-jquery Your web app will have to use that to tell node.js what to do – Nick.Mc May 05 '15 at 04:49
  • I can't test with MAC. But with Windows `=HYPERLINK("brn-0001.xlsx")` should also work without any path, if the `brn-0001.xlsx` is in the same directory as the Excel file which contains the formula. – Axel Richter May 05 '15 at 08:43

0 Answers0