Lewati ke konten utama

Menguraikan CSV ke JSON di dalam Power Automate dengan PDF4me

PDF4me CSV - Uraikan ke JSON adalah sebuah Power Automate tindakan yang mengubah CSV file ke dalam struktur terstruktur JSON array dengan sistem prioritas header tiga tingkat dan pembatas yang dapat dikonfigurasi. Gunakan ini untuk memberi input CSV mengekspor ke dalam basis data, REST APIatau Excel tanpa perlu menulis parser khusus di alur kerja Anda.

Apa yang dilakukan oleh tindakan ini?

PDF4me CSV - Uraikan ke JSON membaca sebuah CSV berkas dan mengembalikan Base64-dikodekan JSON Array objek, dengan Header Kolom, Lewati Baris Pertama, dan Nama Budaya yang mengontrol bagaimana baris dan header diinterpretasikan. Semua pembatas dapat digunakan, dan baris yang salah format ditangani dengan baik alih-alih menyebabkan alur gagal.

Postingan Blog Terkait
Belum ada postingan blog untuk fitur ini — akan segera hadir.
Sementara itu, jelajahi blog PDF4me untuk menemukan tutorial dan alur kerja di berbagai platform.
Kunjungi blog ini

Bagaimana Cara Saya Mengautentikasi Saya? Power Automate Mengalir?

Setiap PDF4me tindakan dalam Power Automate Membutuhkan koneksi yang valid. Buat atau pilih koneksi yang sesuai dengan kebutuhan Anda. PDF4me API kunci agar alur dapat melakukan autentikasi CSV Menganalisis permintaan dengan aman.

Fakta Penting yang Tidak Boleh Anda Lewatkan

Penanganan header memiliki prioritas 3 tingkat yang ketat.
Judul kolom akan diutamakan jika disediakan (setiap CSV baris menjadi data). Jika tidak, Lewati Baris Pertama yang diatur ke true akan menggunakan baris pertama. CSV baris sebagai judul kolom. Jika keduanya kosong, judul kolom akan dibuat secara otomatis sebagai Kolom1, Kolom2, dan seterusnya.
Nama Budaya adalah parameter lanjutan yang mudah terlewatkan.
Tersembunyi di bawah Parameter Lanjutan bersama dengan Header Kolom dan Lewati Baris Pertama, Nama Budaya mengatur lokal yang digunakan untuk menginterpretasikan format angka dan tanggal khusus wilayah. CSV.
Penguraian bersifat permisif, bukan ketat.
Baris dengan nilai lebih sedikit daripada header akan mendapatkan string kosong, baris dengan nilai lebih banyak akan mengabaikan nilai tambahan, dan data yang salah format akan mengembalikan array kosong alih-alih menampilkan kesalahan.
Power Automate PDF4me CSV - Tindakan Parse to JSON dikonfigurasi dengan Konten File, Nama File, Pembatas CSV, dan parameter Lanjutan Header Kolom, Lewati Baris Pertama, dan Nama Budaya.

Petakan Isi File dan Nama File, atur CSV Kemudian, perluas parameter Lanjutan untuk Header Kolom, Lewati Baris Pertama, dan Nama Budaya.

Parameter

Diperlukan: Isi File, Nama File, dan CSV Pembatas (delimiter) harus disediakan. Header Kolom, Lewati Baris Pertama, dan Nama Budaya adalah parameter lanjutan opsional.

ParameterDiperlukanApa fungsinya?Contoh
File ContentRequiredBase64 content of the source CSV file, mapped from SharePoint, OneDrive, or an email attachment.[File Content from Get File]
File NameRequiredCSV filename including extension, used for processing and output identification.data.csv
CSV DelimiterRequiredCharacter or short string separating columns. Comma, semicolon, tab, and pipe are all supported, as are multi-character delimiters.,
Column HeadersOptionalComma-separated custom header names. When provided, every CSV line including the first is treated as data and Skip First Line is ignored.FullName,Age,Email
Skip First LineOptionalWhen true and Column Headers is empty, uses the first CSV line as headers and starts data from the second line. Default false.true
Culture NameOptionalLocale used to interpret region-specific number and date formats in the CSV content.en-US

Bidang Keluaran

BidangJenisIsi di dalamnya
documentBase64The parsed JSON array, UTF-8 encoded and Base64 wrapped.
FileNameStringFixed output filename, "parsed_data.json".
SuccessBooleantrue if parsing completed, false if the action failed.
ErrorMessageStringError description, null when Success is true.
ErrorsArrayDetailed error objects with Code and Message, empty when Success is true.

Apa Arti Pesan Kesalahan Umum Tersebut?

Pesan KesalahanMenyebabkanLarutan
Request is emptyRequest object is null.Provide a valid request object.
Document is emptyDocument object is null or CSV content is null.Provide valid CSV file content.
Encoding exceptionsCSV content is not UTF-8 encoded.Re-save or export the CSV file as UTF-8.
Empty array outputCSV content is empty or contains only a header row.Provide a CSV file with at least one data row.

Bagaimana Cara Saya Mengatur Parse? CSV di dalam Power Automate?

  1. Menambahkan PDF4meCSV - Uraikan ke JSON untuk Anda Power Automate mengalir.
  2. Peta Isi File Dan Nama File dari tindakan sebelumnya (SharePoint, OneDrive, atau lampiran email).
  3. Mengatur Pembatas CSV agar sesuai dengan file sumber Anda (koma, titik koma, tab, atau pipa).
  4. Memperluas Parameter lanjutan dan mengatur Judul Kolom untuk nama khusus, atau Lewati Baris Pertama untuk menggunakan baris header file itu sendiri.
  5. Jalankan alurnya, dekode dokumen Base64 output, dan ulangi proses melalui hasilnya. JSON susunan dengan Terapkan pada setiap.

Pengaturan Umum

Contoh Alur KerjaCommon Power Automate flow patterns using Parse CSV.
Impor CSV ke basis data
  1. A CSV berkas mendarat di SharePoint Folder "Impor", memicu alur kerja.
  2. Parse CSV mengonversinya menjadi JSON dengan CSV Pembatas diatur ke koma dan Lewati Baris Pertama diaktifkan.
  3. Dokumen yang dihasilkan kemudian didekode dan diuraikan menjadi bagian-bagian individual. JSON benda.
  4. Terapkan pada setiap perulangan melalui catatan dan memasukkannya melalui konektor SQL.
  5. Yang diproses CSV dipindahkan ke folder "Arsip".
Ekspor Eropa ke REST API
  1. Sistem sumber mengirimkan email yang dipisahkan oleh titik koma. CSV Ekspor.
  2. Mengurai CSV berjalan dengan CSV Pembatas diatur ke titik koma dan Lewati Baris Pertama diaktifkan.
  3. Setiap catatan yang diurai diposting ke sebuah REST API titik akhir dengan HTTP.
  4. Kode respons dikumpulkan untuk menandai setiap catatan yang gagal.
  5. Ringkasan akan dikirim melalui email setelah proses selesai.
Konversi CSV ke Excel dengan header kustom
  1. Laporan lama diterima sebagai dokumen yang dipisahkan oleh tab. CSV tanpa baris header.
  2. Mengurai CSV berjalan dengan CSV Pembatas diatur ke tab dan Header Kolom diatur secara eksplisit.
  3. Hasilnya JSON array memberi makan sebuah PDF4me Gunakan tindakan Tambah Baris untuk mengisi templat Excel.
  4. File Excel yang sudah diformat dikirim melalui email kepada para pemangku kepentingan.

Tips Praktis

Column Headers overrides Skip First Line completely
If you set Column Headers, Skip First Line is ignored and every CSV row, including what looks like a header row, is treated as data. Do not set both expecting them to combine.
Match the delimiter exactly to the export locale
European CSV exports commonly use a semicolon instead of a comma, especially when the source system uses comma as the decimal separator. Check a sample row before hardcoding the delimiter.
Decode document before parsing further
The document output is Base64-encoded JSON text, not a ready-to-use object. Decode it first, then use Parse JSON to expose individual fields for Apply to each.
Set Culture Name for non-US number formats
If the CSV uses comma as a decimal separator or day-first dates, set Culture Name to match (for example de-DE or en-GB) so downstream conversions do not misread values.
Treat empty output as a signal, not a crash
An empty array back from Parse CSV usually means the file only had a header row or was empty, not that the flow failed. Check Success and Errors before assuming the source file is fine.

Lembar Panduan Singkat

BidangNilai
ActionCSV - Parse to JSON
Header priorityColumn Headers > Skip First Line > auto-generated
Common delimiters, (comma) / ; (semicolon) / \t (tab) / | (pipe)
Output filenameparsed_data.json (fixed)
Output formatdocument (Base64 JSON array)
Malformed data behaviorReturns empty array, does not error

Pertanyaan Umum

How do I parse a CSV file to JSON in Power Automate?+
Add the PDF4me CSV - Parse to JSON action, map File Content and File Name from a prior action, set the CSV Delimiter, then choose Column Headers or Skip First Line for header handling. The action returns document, a Base64 JSON array you can decode and loop through.
What is the header priority order?+
Column Headers takes priority if provided, every CSV line including the first is treated as data. If Column Headers is empty and Skip First Line is true, the first CSV line becomes the headers. If both are empty, headers are auto-generated as Column1, Column2, and so on.
What happens with malformed or empty CSV data?+
CSV parsing is permissive. Rows with fewer values than headers are filled with empty strings, rows with more values than headers have the extras ignored, and empty or header-only CSV content returns an empty JSON array rather than an error.
What does the Culture Name parameter do?+
Culture Name is an advanced parameter that sets the locale used when interpreting the CSV content, useful when the source file uses region-specific number or date conventions that differ from the default parsing culture.
Can I parse semicolon or tab-delimited CSV files?+
Yes. CSV Delimiter accepts any character or short string, including semicolon for European exports, tab for TSV files, or pipe for database exports. Multi-character delimiters are also supported. See <a href="https://www.rfc-editor.org/rfc/rfc4180" target="_blank" rel="noopener noreferrer">RFC 4180, the common CSV format specification</a> and <a href="https://learn.microsoft.com/en-us/connectors/pdf4meconnect/" target="_blank" rel="noopener noreferrer">the PDF4me Power Automate connector reference</a> for background.

Studi Kasus & Aplikasi Industri

  • Integrasi Sistem Warisan: Menguraikan ekspor CSV dari sistem lama ke JSON
  • Umpan Data APIKonversi data CSV ke JSON untuk digunakan pada REST API.
  • Migrasi Basis Data: Mengurai file CSV untuk operasi impor basis data
  • Pemrosesan Berkas Log: Menguraikan file log berformat CSV untuk analisis

Tindakan Terkait

Tugas yang Sama di Platform Lain

Dapatkan Bantuan