如何将图像添加到CSV文件
为了使订单履行过程更加快速和准确,本文将指导您将CSV文件中的图片链接转换为产品图片。当同时履行多个订单时,您只需将产品图片插入CSV文件即可查看正确的产品信息,而无需在ShopBase后台中打开每个订单的详情页。
A. 将订单及其产品图片导出为CSV格式
B. 将图片链接转换为产品图片
ShopBase后台前往 Orders > All orders并勾选您要履行的订单。

点击 Export order。

一个新窗口将弹窗。在 Exports部分中,请选择 Selected ... orders。在 Export template部分中,请选择 Customize export fields。然后,选择要导出的字段。您需要添加以下 3 个字段: Name、 Lineitem Name、 Lineitem Image。要选择字段,请点击与该字段对应的 + 按钮。选择后,这些字段将显示在 Fields To Export 列中,如下所示。

完成后,请点击 Export to file。

请确保每列中的信息字段明确地分开,以免在将图片链接转换为产品图片时出错。
使用Microsoft Excel打开在A部分中已下载的CSV文件,右单击工具栏中的任何空白区域。一个下拉菜单将显示,请选择 Customize the Ribbon。

勾选 Developer,然后点击 OK。

Developer选项卡将如下显示在Microsoft Excel上。

在 Developer选项卡中,选择 Visual Basic以打开 Microsoft Visual Basic for Applications窗口。

当 Microsoft Visual Basic for Applications窗口打开时,选择 Insert > Module。

将以下代码粘贴到Module窗口中。

在上面的代码中,您可以自定义一些价值,例如:Rows ("2: 7") 以确定CSV文件中所有产品信息行的范围(在此例中为从第 2 到第 7 行)、 RowHeight = 60 以调整CSV文件中行的高度(在此例中为 60 像素)、ActiveSheet.Range ("C2: C7") 以确定包含图片链接的范围。(在此例中为从 C2 到 C7 单元格)。
对于此代码,您不能随意指定转换图片的大小。
上面的代码只能将产品图片提取到 Lineitem Image列右边的单元格中,您不能随意指定使用哪些单元格来创建图片。
按 F5 按钮或点击 Run > Run Sub/UserForm以运行此代码。


请稍等片刻,让代码完成。完成时间将取决于文件中的行数。处理一个 650 行的文件大约需要 10 分钟。
将您的文件保存为 .xlsx 格式,以确保它在发送给其他人时可以正常工作。
然后,从图片链接转换的所有产品图片将立即显示在 Lineitem Image列的右边,如下所示:

手动地履行订单
使用 CSV 文件履行订单
使用 PrintHub 履行订单
使用 Ali Dropship Connector 应用履行订单
主要内容
A. 将订单及其产品图片导出为CSV格式
B. 将图片链接转换为产品图片
A. 将订单及其产品图片导出为CSV格式
ShopBase后台前往 Orders > All orders并勾选您要履行的订单。

点击 Export order。

一个新窗口将弹窗。在 Exports部分中,请选择 Selected ... orders。在 Export template部分中,请选择 Customize export fields。然后,选择要导出的字段。您需要添加以下 3 个字段: Name、 Lineitem Name、 Lineitem Image。要选择字段,请点击与该字段对应的 + 按钮。选择后,这些字段将显示在 Fields To Export 列中,如下所示。

完成后,请点击 Export to file。

请确保每列中的信息字段明确地分开,以免在将图片链接转换为产品图片时出错。
B. 将图片链接转换为产品图片
使用Microsoft Excel打开在A部分中已下载的CSV文件,右单击工具栏中的任何空白区域。一个下拉菜单将显示,请选择 Customize the Ribbon。

勾选 Developer,然后点击 OK。

Developer选项卡将如下显示在Microsoft Excel上。

在 Developer选项卡中,选择 Visual Basic以打开 Microsoft Visual Basic for Applications窗口。

当 Microsoft Visual Basic for Applications窗口打开时,选择 Insert > Module。

将以下代码粘贴到Module窗口中。
Sub URLPictureInsert()
Rows("2:7").RowHeight = 60
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("C2:C7")
For Each cell In Rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 1
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoFalse
If .Width > xRg.Width Then .Width = xRg.Width * 2 / 3
If .Height > xRg.Height Then .Height = xRg.Height * 2 / 3
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("A2").Select
Next
Application.ScreenUpdating = True
End Sub

在上面的代码中,您可以自定义一些价值,例如:Rows ("2: 7") 以确定CSV文件中所有产品信息行的范围(在此例中为从第 2 到第 7 行)、 RowHeight = 60 以调整CSV文件中行的高度(在此例中为 60 像素)、ActiveSheet.Range ("C2: C7") 以确定包含图片链接的范围。(在此例中为从 C2 到 C7 单元格)。
对于此代码,您不能随意指定转换图片的大小。
上面的代码只能将产品图片提取到 Lineitem Image列右边的单元格中,您不能随意指定使用哪些单元格来创建图片。
按 F5 按钮或点击 Run > Run Sub/UserForm以运行此代码。


请稍等片刻,让代码完成。完成时间将取决于文件中的行数。处理一个 650 行的文件大约需要 10 分钟。
将您的文件保存为 .xlsx 格式,以确保它在发送给其他人时可以正常工作。
然后,从图片链接转换的所有产品图片将立即显示在 Lineitem Image列的右边,如下所示:

关联页面
手动地履行订单
使用 CSV 文件履行订单
使用 PrintHub 履行订单
使用 Ali Dropship Connector 应用履行订单
更新于: 09/03/2023
谢谢!