Zum Hauptinhalt springen

Zeilen extrahieren aus Excel

PDF4me Zeilen extrahieren ist ein REST Endpunkt, der Arbeitsblattzeilen aus einem Excel Arbeitsmappe und gibt sie strukturiert zurück JSONDie POST die .xlsx als Base64 Zu office/ApiV2Excel/ExcelExtractRows, den Arbeitsblatt- und Zeilenbereich im Aktionsobjekt festlegen und die rowData Es gibt ein Array zurück, keine Datei: document wird als Null zurückgegeben.

Was dieser Endpunkt bewirkt

Wandelt einen Arbeitsblattausschnitt in einen um JSON Array: Jede Zeile wird zu einem Objekt in rowData, bereit für einen Datenbankeintrag, ein API Anruf oder Bericht. Es ist das schreibgeschützte Gegenstück zu Zeilen hinzufügen und Zeilen aktualisieren, und das API-seitiges Äquivalent zum Exportieren Excel Daten ohne Öffnen ExcelEs wird keine veränderte Datei erzeugt.

Verwandte Blog-Beiträge
Zu dieser Funktion gibt es noch keinen Blogbeitrag – folgt in Kürze.
Schauen Sie sich in der Zwischenzeit im PDF4me-Blog Tutorials und Arbeitsabläufe für alle Plattformen an.
Besuchen Sie den Blog

Authentifizierung Ihres API Anfrage

Jeder PDF4me REST Der Anruf muss Ihre API Schlüssel im Authorization Header als Basic Auth. Ihren Schlüssel erhalten oder ändern Sie ihn im Entwickler-Dashboard.

Endpunkt

POSToffice/ApiV2Excel/ExcelExtractRows

Wichtige Fakten, die Sie nicht verpassen sollten

rowData ist die Ausgabe, die Dateifelder sind null.
Dieser Endpunkt liefert Daten zurück, keine geänderte Arbeitsmappe. dokumentieren Und fileName wird absichtlich als Nullwert zurückgegeben; Code, der einen Wert erwartet Base64 Die Datei wird beschädigt.
Die Engine zählt Zeilen ab dem Zeitpunkt 0.
Zeile 0 ist Excel Zeile 1 und -1 bedeuten bis zur letzten Datenzeile, die gleiche Semantik wie die n8n Dokumente zur Aktion „Zeilen extrahieren“ für diese Engine. Off-by-One-Bereiche sind die häufigste Supportanfrage.
Schreibgeschützt: Ihre Arbeitsmappe ist unverändert.
Die Extraktion analysiert die Datei und serialisiert die Zeilen zu JSONDa nichts zurückgeschrieben wird, kann das Programm bedenkenlos gegen Produktionsarbeitsmappen und Archive ausgeführt werden.

HTTP aufstellen

Verfahren: POST
URL: https://api.pdf4me.com/office/ApiV2Excel/ExcelExtractRows
Inhaltstyp: application/json
Authorization: Basic <Ihre PDF4me API Schlüssel>

Die Antwort lautet: JSON: Überprüfen Sie die success Flagge, dann iteriere die rowData Array. Es ist keine Datei zum Dekodieren vorhanden.

Worin unterscheidet sich „Zeilen extrahieren“ von den anderen Funktionen? Excel Zeilenaktionen?

Die Zeilenfamilie umfasst die Optionen Schreiben, Überschreiben und Lesen. Wählen Sie die Option je nachdem, was mit dem Arbeitsbuch geschehen soll.

Handlung vs. VerhaltenWas es mit dem Arbeitsbuch machtWas Sie zurückbekommen
Zeilen extrahieren (dieser Endpunkt)Nichts, nur lesbarA rowData JSON Array, ein Objekt pro Zeile
Zeilen hinzufügenFügt neue Zeilen hinzu oder fügt sie einDie geänderte Arbeitsmappe als Base64
Zeilen aktualisierenÜberschreibt Werte in bestehenden ZeilenDie geänderte Arbeitsmappe als Base64
Zeilen löschenEntfernt ZeilenDie geänderte Arbeitsmappe als Base64

API Körperfelder

ParameterErforderlichTypWas es tutBeispiel
documentRequiredobjectDocument reference carrying Name, the Excel filename with its extension.{ "Name": "data.xlsx" }
docContentRequiredstringBase64-encoded bytes of the workbook to read.UEsDBBQABgAIAAAA...
extractRowsToExcelActionRequiredobjectAction configuration object. An empty object is valid and reads the default worksheet.{}
worksheetNameOptionalstringInside the action object. Target worksheet by name. Names are matched exactly, so a typo silently misses the sheet.Sheet1
worksheetIndexOptionalnumberInside the action object. Target worksheet by position. The extraction engine counts 0-based, so 0 is the first sheet.0
fromRow / toRowOptionalnumberInside the action object. Row range to extract. The engine counts rows 0-based with -1 meaning to the last data row, per the shared engine documented on the n8n Extract Rows action.0, -1
cultureNameOptionalstringInside the action object. Culture used when serializing dates and numbers, for example en-US or de-DE.en-US

Beispielnutzlasten

Lesen Sie das Standardarbeitsblatt

{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"extractRowsToExcelAction": {}
}

Lesen Sie ein benanntes Arbeitsblatt mit kultursensiblen Werten.

{
"document": { "Name": "sales.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"extractRowsToExcelAction": {
"worksheetName": "Q3",
"cultureName": "en-US"
}
}

Tipps zur Postboten-Abholung

Headers
Content-Type: application/json + Authorization: Basic <apiKey>.
Body
raw JSON. extractRowsToExcelAction may be an empty object {}; worksheet targeting and ranges are optional narrowing.
Response
Plain JSON. Assert on rowData, not on document: the file fields are null for this endpoint by design.
Ranges
The engine counts rows 0-based and treats -1 as "to the last data row". Test with a small explicit range first.

Beispiel für curl

curl -X POST https://api.pdf4me.com/office/ApiV2Excel/ExcelExtractRows \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"document": { "Name": "data.xlsx" },
"docContent": "'"$(base64 -w 0 data.xlsx)"'",
"extractRowsToExcelAction": { "worksheetName": "Sheet1" }
}' \
--output response.json

Was bedeutet das? API zurückkehren?

A JSON Ergebnis, dessen Nutzlast die rowData Array.

FeldTypWas es enthält
rowDataArray of objectsThe primary output. Each entry is one extracted row as a JSON object, with column names or indexes as keys.
successBooleantrue when extraction succeeded. Check this before iterating rowData.
documentnullNull for this endpoint: no modified file is produced. Present only because the office family shares one response shape.
fileNamenullNull for this endpoint, for the same reason as document.
errorMessageStringPopulated when success is false: a missing worksheet, invalid Base64, or a corrupted workbook.
{
"document": null,
"fileName": null,
"success": true,
"errorMessage": null,
"rowData": [
{ "ColumnA": "value1", "ColumnB": "value2" },
{ "ColumnA": "value3", "ColumnB": "value4" }
]
}

Codebeispiele

Excel Büroendpunkte sind noch nicht durch die pro-language Beispielordner; das Beispiel-Repository enthält das Anfragemuster, das von jedem verwendet wird PDF4me Endpunktfamilie:

Häufig gestellte Fragen

Why are document and fileName null in the response?+
Because Extract Rows returns data, not a modified workbook. The primary output is the rowData array of row objects; the file-oriented fields exist in the shared response shape but stay null for this endpoint.
Are row indexes 0-based or 1-based?+
The extraction engine behind this action counts rows and columns 0-based, so row 0 is Excel row 1, and -1 means read to the last data row or column. If your range seems off by one, this is why.
Can I pipe the output into a database or another API?+
Yes, that is the point of the endpoint. rowData is plain JSON: each array entry is one row as an object, ready for an INSERT statement, an HTTP POST, or any downstream transformation.
What happens if I send an empty action object?+
The action still runs: the API reads the default worksheet and returns its rows. Add worksheetName or a row range only when you need to narrow the extraction.
Does this endpoint modify my Excel file?+
No. It is read-only. The source workbook is parsed, the rows are serialized to JSON, and no modified file is produced or returned.
Can I read a password-protected workbook?+
No. Protection blocks parsing. Chain the Unlock Excel action first with the correct password, then extract from the unlocked copy.
How do I extract whole worksheets instead of rows?+
Use the Extract Worksheets action, which splits worksheets out of the workbook. Extract Rows is for reading row values as JSON; Extract Worksheets is for separating sheets as workbook content.

Warum extrahieren Excel verschenkt API statt manuell?

Die manuelle Methode besteht darin, die Arbeitsmappe zu öffnen, den Bereich auszuwählen, ihn irgendwohin zu kopieren und ihn dann manuell umzuformen – einmal pro Datei, einmal pro Aktualisierung. API liest dieselben Zeilen wie eine deterministische Anfrage und gibt sie Ihnen zurück JSON dass irgendein language wird nativ analysiert, ohne dass Excel Installation auf dem Server. Da der Quellcode ein Standard bleibt. Büro geöffnet XML Die Arbeitsmappe und der Vorgang sind schreibgeschützt, der gleiche Aufruf kann jedoch gefahrlos nach einem Zeitplan für Live-Dateien ausgeführt werden.

Ähnliche Aktionen

Dieselbe Aufgabe auf anderen Plattformen

Hilfe erhalten