如何在C#中表示可用的Excel文件 [英] How to denote the available excel file in c#

查看:68
本文介绍了如何在C#中表示可用的Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码读取Excel文件名.但我想阅读可用的文件.它可以是Links.xlsx,survey.xlsx或其他名称.我怎样才能做到这一点.如何为可用文件名指定名称?

I''m using this code to read an excel file name. But i want to read the available file. It can be Links.xlsx, survey.xlsx or something else. How can i do that. How can i denote the name for available file name??

String ExcelFile = Application.StartupPath +@"\Links.xlsx";

推荐答案

我该怎么做.
您需要首先在该文件夹中找到所有文件,然后循环/查找所需的文件.如果一次只有一个文件,请使用该文件.

要查找文件夹中的所有文件,请执行以下操作:从目录[C#]中获取文件 [ ^ ]
How can i do that.
You need to find all the files in that folder first and then loop/find the one that you need to. If there would be only one file at a time, then use that one.

To find all files in a folder: Get Files from Directory [C#][^]


这篇关于如何在C#中表示可用的Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆