Tag: 文件

“WSGIRequest”对象没有属性“FILE”

我想做一个应用程序,需要Excel文件,并阅读其内容,而不使用窗体和模型。 我不断收到标题中的错误,我想知道错误是什么。 这是我的HTML: <div style="width: 800px; margin: 0 auto;"> <form enctype="multipart/form-data" action="." method='POST'> {% csrf_token %} <input type="file" name="excelfile"> <input type="submit" value="Submit" /> </form> </div> 这是我的看法: def uploadexcelfile(request): if request.method == "POST": excel = request.FILE['excelfile'].read() print('Opening workbook…') wb = openpyxl.load_workbook(excel) activesheet = wb.active print(activesheet.title) sheet = wb.get_sheet_by_name(activesheet.title) print('Reading rows…') for row in range(1, sheet.max_row + […]

如何保存文件而不用覆盖现有的同名文件

我正在尝试将文件另存为* .xlsx而不覆盖具有相同名称的现有文件。 我想在只有指定文件存在的情况下,才能将新的数字后缀添加到新的文件名中,例如file(1).xlsx,file(2).xlsx。 在这里,我已经尝试了迄今为止: do { s = JOptionPane.showInputDialog("Enter the name of the file name"); File tmpDir = new File(System.getProperty("user.home"), "Documents\\Challan_Reports\\" + s + ".xlsx"); boolean exists = tmpDir.exists(); if (exists) { JOptionPane.showMessageDialog(this, "File Name Already exists try again!"); } else { break; } } while (true); if (s.equals("") || s.equals(null)) { //………………………………………………………………. File tmpDir […]

C#把大的excel文件分割成更小的文件

我想将一个大的Excel文件分割成几个较小的可访问的文件。 我已经尝试使用此代码,但文件不可访问: using (System.IO.StreamReader sr = new System.IO.StreamReader("path")) { int fileNumber = 0; while (!sr.EndOfStream) { int count = 0; using (System.IO.StreamWriter sw = new System.IO.StreamWriter("other path" + ++fileNumber + ".xlsx")) { sw.AutoFlush = true; while (!sr.EndOfStream && ++count < 20000) { sw.WriteLine(sr.ReadLine()); } } } } 有任何想法吗? 谢谢。

转换excel base64到可下载的文件PHP

大家,即时通讯运行在一些问题,现在看到的内部情况与服务器,我不能控制或任何东西现在我不能使用base64编码的文件直接通过网站,因为当服务器提供内容的浏览器,它有一个字符的限制对于这些任务,它直接影响这些string长度的base64编码文件的原因,所以我做了一个系统的PHP脚本,将已经存在的base64 pdf文件作为可下载的文件提交给客户端,它的工作原理是这样的: $reg = File::find($args->string('id')); //querying the file from database $filename = $reg->filename; //the original file name $base64 = $reg->file; //the base64 encoded file $meta_type = explode(',', $base64) [0]; //getting the meta type of the file $meta_type = str_replace('data:', '', $meta_type); $meta_type = str_replace(';base64', '', $meta_type); $file = explode(',', $base64) [1]; $file = base64_decode($base64); //decoding […]

重命名后无法访问excel文件

我已经重命名了我的Web服务器上的一些Excel文件,重命名后,用户无法下载这些文件。 可能是什么问题呢。 他们都是excel文件。

如何在C#中使用OLEDB创build和更新电子表格?

HI! 我正在使用以下代码创build.xls电子表格文件 using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\temp.xls;Extended Properties='Excel 8.0;HDR=Yes'")) { conn.Open(); OleDbCommand cmd = new OleDbCommand("CREATE TABLE [NewSheet] ([Column1] string, [Column2] string)", conn); cmd.ExecuteNonQuery(); } 但我得到一个exception在cmd.ExecuteNonQuery(); 例外是: 不能修改表“NewSheet”的devise。 它在一个只读数据库中。 请帮我解决这个问题 谢谢

查找可能位于三个位置之一的文件

我需要编写一个vba脚本来查找文件。 该文件可能在三个不同的位置 我如何find文件的位置? 该文件必须具有特定的string作为文件名的一部分 我的文件名可能是9424.bas或9424a.esy或9424_.bas或9424 …艾西,我知道什么文件名正是,但我知道重要的字符9424

不用Excel引擎打开和closures编辑Excel

有没有办法读取而不打开它的Microsoft Excel文件? 打开和closuresexcel文件的确是非常慢的操作。 在我的程序中,我想一次编辑17个excel文件并保存。 请帮忙

打开具有date时间字段的CSV文件,在Excel中打开“######”

在具有date时间字段的Excel中打开一个CSV文件时,它将在excel中打开,标记为“######”。 有没有办法打开CSV文件格式的Excel文件?

如何使文件在Excel中可视化

我有一个Groovy脚本来抓取大文本文件中的数据。 我想用此脚本制作一个制表符分隔的数据文件,然后使用该文件作为Excel可视化文件。 什么是最好的文件types创build,以及如何在Groovy中创build它? 谢谢!