最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Open Excel file url in excel (from source, not downloaded copy) - Stack Overflow

programmeradmin2浏览0评论

In IE, it's quite easy to "Open in Excel" a url to a file on a network or internet location. Is the same possible in Chrome though? The file must be opened from its current location, not from a downloaded copy. So when the user saves any changes, they save to the original location. IE Tab isn't an option either, we cant install chrome extensions.

Things I've tried:

1) Web protocol: "ms-excel:ofe|u"

<a href="ms-excel:ofe|u|//server/folder/Test.xls">Open in Excel</a>

2) ActiveX (I know it wouldnt work with Chrome, adding for pleteness)

<input type=button onClick="test()" value="javascript solution">

<script type="text/javascript">
    function test() {
        var Excel = new ActiveXObject("Excel.Application");
        Excel.Visible = true;
        Excel.Workbooks.Open("//server/folder/Test.xls");
    }
</script>

3) Direct link to the file:

<a href="//server/folder/Test.xls">Click</a><br />

This just downloads the file to the local machine and can be set to open as soon as it downloads, but changes are saved locally.

UPDATE: I've found that trying to access a file stored in sharepoint works using method 1 above.

<a href="ms-excel:ofe|u|http://sharepointserver/sites/rptserver/Test.xls">Open in Excel</a>

Any reason it would work for sharepoint files but not files stored in a network location?

UPDATE: I've found documentation for the ms-excel:ofe|u| web protocol which states that only http and https are supported.

*Bounty will only be awarded to answers to the specific question:

Is there any way to open a file in excel with chrome where the path to the file is a local or network storage location rather than a http/https url?

In IE, it's quite easy to "Open in Excel" a url to a file on a network or internet location. Is the same possible in Chrome though? The file must be opened from its current location, not from a downloaded copy. So when the user saves any changes, they save to the original location. IE Tab isn't an option either, we cant install chrome extensions.

Things I've tried:

1) Web protocol: "ms-excel:ofe|u"

<a href="ms-excel:ofe|u|//server/folder/Test.xls">Open in Excel</a>

2) ActiveX (I know it wouldnt work with Chrome, adding for pleteness)

<input type=button onClick="test()" value="javascript solution">

<script type="text/javascript">
    function test() {
        var Excel = new ActiveXObject("Excel.Application");
        Excel.Visible = true;
        Excel.Workbooks.Open("//server/folder/Test.xls");
    }
</script>

3) Direct link to the file:

<a href="//server/folder/Test.xls">Click</a><br />

This just downloads the file to the local machine and can be set to open as soon as it downloads, but changes are saved locally.

UPDATE: I've found that trying to access a file stored in sharepoint works using method 1 above.

<a href="ms-excel:ofe|u|http://sharepointserver/sites/rptserver/Test.xls">Open in Excel</a>

Any reason it would work for sharepoint files but not files stored in a network location?

UPDATE: I've found documentation for the ms-excel:ofe|u| web protocol which states that only http and https are supported.

*Bounty will only be awarded to answers to the specific question:

Is there any way to open a file in excel with chrome where the path to the file is a local or network storage location rather than a http/https url?

Share Improve this question edited Aug 28, 2019 at 8:02 Kieran Quinn asked Aug 26, 2019 at 9:11 Kieran QuinnKieran Quinn 1,1152 gold badges24 silver badges53 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6 +50

No it is not possible for security reasons. All newer browsers (and I guess even the newer implementations of IE), don't allow file access to the local system. Internet Explorer is the only browser that supports opening files from locations, that are seen and treated as local ones.

You can open files from a Webdav Server, which is probably, why you can access files from your SharePoint, so you could try mapping that provider of your network drive as a Webdav Server.

Source: https://www.codeproject./Questions/1180249/Open-edit-save-excel-sheet-from-browser-using-java AND Is there an Application URL Protocol for MS Word?

You upload your excel on Google drive and people can use it from google sheets. Browser functionality is to download the copy of file to local Computer. You should use File server FTP server and other Protocols to actually edit file at source. There are Web file manager software which can give you ability to save file. Try Cloud version of software etc to save file in web page and see the version history too. GitHub can have Private repository too.

发布评论

评论列表(0)

  1. 暂无评论
ok 不同模板 switch ($forum['model']) { /*case '0': include _include(APP_PATH . 'view/htm/read.htm'); break;*/ default: include _include(theme_load('read', $fid)); break; } } break; case '10': // 主题外链 / thread external link http_location(htmlspecialchars_decode(trim($thread['description']))); break; case '11': // 单页 / single page $attachlist = array(); $imagelist = array(); $thread['filelist'] = array(); $threadlist = NULL; $thread['files'] > 0 and list($attachlist, $imagelist, $thread['filelist']) = well_attach_find_by_tid($tid); $data = data_read_cache($tid); empty($data) and message(-1, lang('data_malformation')); $tidlist = $forum['threads'] ? page_find_by_fid($fid, $page, $pagesize) : NULL; if ($tidlist) { $tidarr = arrlist_values($tidlist, 'tid'); $threadlist = well_thread_find($tidarr, $pagesize); // 按之前tidlist排序 $threadlist = array2_sort_key($threadlist, $tidlist, 'tid'); } $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $access = array('allowpost' => $allowpost, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete); $header['title'] = $thread['subject']; $header['mobile_link'] = $thread['url']; $header['keywords'] = $thread['keyword'] ? $thread['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>