简体   繁体   English

从Excel工作表进行SQL查询或PHP查询

[英]SQL Query or PHP Query from Excel Sheets

My suppliers in South Africa do not use live xmls for their stock lists. 我在南非的供应商未使用实时XML作为其库存清单。

Each of our suppliers stock lists ( excel pricelists ) have very different layouts. 我们的每个供应商库存清单(excel价格清单)都有非常不同的布局。 The only way I currently do updates is by copying the code and the price into a new excel csv sheet and import. 我目前进行更新的唯一方法是将代码和价格复制到新的Excel csv表中并导入。 Then the product codes that it can't pickup will automatically be put in the “products” category with just the code and the price. 然后,无法提取的产品代码将自动包含在代码和价格中的“产品”类别中。 The rest I do manually. 其余的我手动完成。 Adding the short description, product name and correct category. 添加简短描述,产品名称和正确的类别。

Is there anyway to make this more automated. 无论如何,有没有使它更加自动化的方法。 We currently have over 15 different pricelists and in excess of 30k products. 我们目前有15种以上的价目表,超过3万种产品。

I want it to automatically fetch the products image from google based on the products name. 我希望它根据产品名称自动从Google获取产品图片。 Automatically add it to the correct category? 自动将其添加到正确的类别? I assume I would have to set conditions such as code starting with MO- go to computers///peripherals///mouses. 我假设我必须设置条件,例如以MO开头的代码-转到计算机///外围设备////鼠标。 Or for it to ask me to set conditions to look for in product code or short descriptions then it will do the rest? 还是要求我设置条件以在产品代码或简短描述中查找,然后剩下的工作就会解决?

I also want that when a product is missing from the pricelists it gets hidden. 我还希望当价格表中缺少某种产品时将其隐藏起来。

Is this possible? 这可能吗?

Well, PHP has all the tools you need: 好吧,PHP具有您需要的所有工具:

  1. Database Interface 数据库接口
  2. Getting the contents of a web page (Hopefully you could get the image by some method other than Google search, because that would be unreliable: how would you know you got the right result? But there are lots of examples of people using PHP to search Google--just search the internet). 获取网页的内容 (希望您可以通过Google搜索以外的其他方法来获取图像,因为那将是不可靠的:您怎么知道您得到了正确的结果?但是有很多人使用PHP进行搜索的示例Google-只需搜索互联网)。
  3. Writing an Excel file . 编写Excel文件

Or in Perl, my preferred tool: DBI , LWP::Simple , and Spreadsheet::WriteExcel . 或在Perl中,我首选的工具是: DBILWP::SimpleSpreadsheet::WriteExcel

I would not try doing this with VBA in Excel if you have other options. 如果您有其他选择,我不会尝试使用Excel中的VBA进行此操作。 In my experience, that leads to repeatedly hitting one's head against the wall. 以我的经验,这会导致头部反复撞墙。 It probably is possible to do it that way, as well, though. 不过,也有可能这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM