嗨,我需要读取存储在 s3 服务器中的 excel 文件,我试过但它显示无效的互联网地址。请帮我解决
string fullPath = "http://tempfordevelopment.s3.amazonaws.com/ad53498f-74e8-412c-8c8f-e36b18f16e4eEmailExcel2.xlsx";
//Uri uri = new Uri(fullPath);
//string excelLocation = uri.LocalPath;
String sConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + fullPath + "; Extended Properties='Excel 8.0;HDR=Yes'";
System.Data.DataSet DtSet;
System.Data.OleDb.OleDbDataAdapter MyCommand;
OleDbConnection objConn = new OleDbConnection(sConnectionString);
MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", sConnectionString);
MyCommand.TableMappings.Add("Table", "Net-informations.com");
DtSet = new System.Data.DataSet();
MyCommand.Fill(DtSet);/////Here i am getting error as invalid internet address
DataTable table = DtSet.Tables[0];
string[] strings = new string[table.Rows.Count];
int idx = 0;
foreach (DataRow row in table.Rows)
{
StringBuilder sb = new StringBuilder();
object[] cells = row.ItemArray;
for (int i = 0; i < cells.Length; i++)
{
if (i != 0) sb.Append(',');
sb.Append(cells[i]);
}
strings[idx++] = sb.ToString();
}